Thanks for the suggestions so far!

query-replace does not seem to work across newlines (to my surprise).

foo[\s^J]bar also does not work; I thought \s- was supposed to match any whitespace, including newline, and not be interpreted as part of a range in this case.

This one below does work, and thank you! But as you say, it's kludgy. Is this really the best emacs can do to replace a phrase?! Why doesn't \s- work in this context? Is there no way to match any whitespace?

Jeremiah Dodds wrote:
The following works for me with the words separated by arbitrary whitespace including newlines (although it is ugly, and I'm sure there's better ways to do it): M-x replace-regexp foo[ ^TAB^j]*bar[ ^TAB^j]*baz[ ^TAB^j] RET fbb RET


View this message in context: Re: replacing phrases: matching line feeds in regular expressions, since \s- doesn't work
Sent from the Emacs - Help mailing list archive at Nabble.com.