inconsistency? Re: Boy do REs ever suck sometimes...
tim.one at home.com
Fri Oct 5 21:55:24 CEST 2001
> I think the following behaviour of re module is incorrect:
> >>> re.match("^(123)($)", "123\n").group(1, 2)
> ('123', '')
> If $ matches \n, then why doesn't it include it to the
Because the antecedent is incorrect: $ is a "zero-width assertion", like \b
and ^: if it matches it all, it matches a null string. The only useful
behavior of zero-width assertions is to make a path of the match attempt
fail if the asserted condition doesn't hold.
More information about the Python-list