From: "David A. Black" Date: 2005-04-07T22:47:07+09:00 Subject: Re: Regular expression mismatch ? Hi -- On Thu, 7 Apr 2005, Kujawa, Greg wrote: > > -----Original Message----- > From: David A. Black [mailto:dblack@wobblini.net] > Sent: Thursday, April 07, 2005 9:09 AM > To: ruby-talk@ruby-lang.org > Subject: Re: Regular expression mismatch ? > > > Hi -- > > On Thu, 7 Apr 2005, Han Holl wrote: > >> On Apr 7, 2005 12:34 PM, David A. Black >>> The /m suffix means that \n is included in . (dot). >>> >> Yes, looked it up in the Pickaxe, and indeed that's what it says. >> >> This is from man perlre: >> m Treat string as multiple lines. That is, change "^" and "$" >> from matching the start or end of the string to matching then >> start or end of any line anywhere within the string. >> >> This should go on the page I've seen somewhere with gotchas. Perl RE >> is quite widespread, and when ruby deviates from it it's easy to trip >> up. > > Not if you use Ruby more and more :-) > Good point. Anyone who has worked with regexes in the various languages can > attest to subtle (but far-reaching) differences between them. I recall the > first time I picked up the "Mastering Regular Expressions" book. A veritable > Bible for the beasties... That's the thing... for better or worse, there's no single model for how regexes work. Some things are more universal than others, but I don't think there's any shortcut to adapting to whatever incarnation of them one is using at a given time. David -- David A. Black dblack@wobblini.net