Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!EDDIE.MIT.EDU!think!compass!worley From: think!compass!worley@EDDIE.MIT.EDU (Dale Worley) Newsgroups: gnu.emacs Subject: Matching multiple lines with regex Message-ID: <8903161534.AA03948@galaxy.compass.com> Date: 16 Mar 89 15:34:31 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 15 I'm using the regex code out of 18.52 and would like to construct a regular expression that will match *all* of the characters in a string of text containing newlines. I tried ".*" (the most obvious), but it just matches up to the first newline. I haven't got newlines being treated specially in any way (I.E. as "or"s) so I can't figure out why this is happening. The reason it is happening is because '.' is defined to not match newlines. (See Info node "Regexps", or search for 'anychar' (the internal code for the '.' regexp) in regex.c and examine the code in those areas.) If you want to match newline also, you will have to say '\(.\|^J\)', or in C, "\\(.\\|\n\\)". Dale