According to https://www.emacswiki.org/emacs/RegularExpression#regexp
\(\w+\) +\1\>
finds two consecutive identical words. It works if the words are in the same line separated by an arbitrary number of white spaces. How to find consecutive identical words not necessarily in the same line by a regexp? According to the link above
\(\<\w+\>\)\s-+\1
can do the job. But I don't know why it cannot find the duplicate words file file below
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file
file with C-x C-f,
;; then enter the text in in that file's own buffer.