[Tutor] Regular expressions - Ignoring linefeeds

doug shawhan doug.shawhan at gmail.com
Fri Mar 2 18:34:28 CET 2007


I've been looking through various sites, but cannot find the magic button
that allows me to match a string with linefeeds
I'd rather not strip out the linefeeds, then stick them back in. :-)

I'm attempting something that should be fairly simple:

snippy = re.compile('Hi there.*Bye there.')

s = '''Good gravy! Hi there.
I'm some text someone
wants to match.
Bye there. See you around'''

yield = re.match(snippy)

Anything after the linefeed is not matched, yielding naught but pain.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070302/fcbe7865/attachment.html 


More information about the Tutor mailing list