[EMAIL PROTECTED] wrote: > On Sep 21, 2:44 pm, David <[EMAIL PROTECTED]> wrote: >>> data = "asdfasgSTARTpruyerfghdfjENDhfawrgbqfgsfgsdfg" >>> x = re.compile('START.END', re.DOTALL) >> This should work: >> >> x = re.compile('START(.*)END', re.DOTALL) > > You'll want to use a non-greedy match: > > x = re.compile(r"START(.*?)END", re.DOTALL) > > Otherwise the . will match END as well. > Only if there's a later END in the string, in which case the user's requirements will determine whether greedy matching is appropriate.
regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden Sorry, the dog ate my .sigline -- http://mail.python.org/mailman/listinfo/python-list