tobiah wrote: > Sorry, I should have tried harder. I see that the text > of the match is simply not consumed, so that: > > m = re.search('(?=foo)fo', 'food') > > succeeds, while > > m = re.search('(?=fox)fo', 'food') > > does not.
They are more commonly used, and generally more useful, at the end of a regexp: m = re.search(r"foo(?=d)","food") matches, but afterwards m.group(0)=="foo" (without the d). Meanwhile, m = re.search(r"foo(?=d)","fool") doesn't match at all. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list