[issue9179] Lookback with group references incorrect (two issues?)

andrew cooke report at bugs.python.org
Tue Jul 6 12:30:30 CEST 2010


andrew cooke <andrew at acooke.org> added the comment:

I hope the above is clear enough (you need to stare at the regexps for a time) - basically, lookback with a group conditional is not as expected (it appears to be evaluated as lookahead?).  Also, some patterns compile that probably shouldn't.

The re package only supports (according to the docs) lookback on expressions whose length is known.  So I guess it's also possible that (?(n)pat1|pat2) should always fail that, even when len(pat1) = len(pat2)?

Also, the generally excellent unit tests for the re package don't have much coverage for lookback (I am writing my own regexp lib and it passes all the re unit tests but had a similar bug - that's how I found this one...).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9179>
_______________________________________


More information about the Python-bugs-list mailing list