[Python-Dev] Behavior of matching backreferences

Gustavo Niemeyer niemeyer@conectiva.com
Sun, 23 Jun 2002 20:30:06 -0300

Hello Tim!

> Wow, yesterday's drugs haven't worn off yet <wink>.  The details of this
> explanation were partly full of beans.  Let's consider a different regexp:

Thanks for explaining again, in a way I could understand. :-)

>     ^(a)?b\1$
> Should that match
>     b
> or not?  Python and Perl say "no" today, because \1 refers to a group that
> didn't match.  Ir remains unclear to me whether Gustavo is saying it should,
> but, if he is, that's too big a change, and
>     ^(a?)b\1$

I still think it should, because otherwise the "^(a)?b\1$" can never be
used, and this expression will become "^((a)?)b\1$" if more than one
character is needed. But since nobody agrees with me, and both languages
are doing it that way, I give up. :-)

Could you please reject the patch at SF?

Thank you!

Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]