Consider a buffer as below. As explained in the documentation .
matches any character but newline. Also \n
matches newline. So evaluating (re-search-forward "a\(.\|\n\)*b" nil t)
should normally have a match in this document. But it does not.
(As explained in https://emacs.stackexchange.com/a/9549/ when using regular expressions interactively, a\(.\| C-q C-j \)
seems to be fine in this situation).
a
b