A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-June/025851.html below:

[Python-Dev] Behavior of matching backreferences

[Python-Dev] Behavior of matching backreferences [Python-Dev] Behavior of matching backreferencesTim Peters tim.one@comcast.net
Sun, 23 Jun 2002 15:00:25 -0400
[Tim]
> ..
> There's no such beast as "an optional group".  The
>
>     ^(a)
>
> part *must* match or the entire regexp fails, period, regardless
> of whether or not backreferences appear later.  The question mark
> following doesn't change this requirement. ...

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:

    ^(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$

is the intended way to spell it.





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4