On 7/19/06 at 9:51 PM, [EMAIL PROTECTED] (Robert Hicks) wrote: > Andrew Brosnan wrote: > > I'm processing a string with embedded newlines. For testing I was > > storing the text in __DATA__ and slurping it into a string. This > > works fine. However when I read in a file, I'm having trouble with > > the line endings. Matching begining/end of logical lines is not > > working as I expect. Regexes like the one below match when using > > the DATA filehandle, but don't when opening other text files on my > > Mac. > > > > $text =~ s/^Text to match.*$//m; > > > > Is this due to UNIX '\n' vs. Mac '\r' line endings? I assumed the > > 'm' modifier would recognize any line ending. > > > > Oh what to do? > > > > Andrew > > > What version of the Mac?
10.3.9 > Anything in the OSX family is Unix and uses the > standard "\n" line ending I don't think that is the case. These are text files created on 10.3.9 and they use \r for line endings. The problem is that /^.*$/ won't match lines ending with \r even with the m modifier. Andrew