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: http://old.nabble.com/replacing-phrases%3A-matching-line-feeds-in-regular-expressions%2C-since-%5Cs--doesn%27t-work-tp33349186p33350095.html Sent from the Emacs - Help mailing list archive at Nabble.com.