On 3/2/07, doug shawhan <[EMAIL PROTECTED]> wrote: > 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. :-)
Try this: >>> s = '''Good gravy! Hi there. I'm some text someone wants to match. Bye there. See you around''' >>> snippy = re.compile('Hi there.*Bye there.', re.DOTALL) >>> yeild = re.search(snippy, s) >>> yeild.group() "Hi there.\nI'm some text someone\nwants to match.\nBye there." The important bits are compiling your regular expression with re.DOTALL so that a dot will match newlines, and using re.search instead of re.match. -- Jerry _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor