[comp.emacs] Newlines in regexps

S.Clayman@CS.UCL.AC.UK (05/29/91)

Gabriel writes:

>> 
>>    I guess what I am really asking is: is there an easy way to put newlines
>>    in regexps?
>> 
>> No, and this is a problem.  I've always thought that emacs regexps
>> should have a special character that matches ALL chacters, including
>> newlines.  Not having this makes writing certain regexps cumbersome. 

The answer is YES.

Try re-searching for [a-z]^Q^J[a-z]

This will find every line that ends in an alpha char followed by a
line that starts with a alpha char.

I suppose the secret is to treat the newline as the ^J character not
some special regexp end-of-line.  I use this regularly.

Stuart

acevedo@ATHENA.MIT.EDU (05/30/91)

   The answer is YES.

   Try re-searching for [a-z]^Q^J[a-z]

No, that falls under the "cumbersome" category.  It is also limited to
lines that start/end with letters.  I like the other
suggestion:

	[\000-\377]