[issue214033] re incompatibility in sre

Jeffrey C. Jacobs report at bugs.python.org
Mon Oct 13 15:06:04 CEST 2008


Jeffrey C. Jacobs <timehorse at users.sourceforge.net> added the comment:

The duplicate zero-or-one repeat operator bug described in this issue 
originally no longer exists in python 2.6.

However, Trent Mick brings up a fair point in that expressions of the 
form (x*)? generate an error (issue 1456280) when internally the '?' 
should be passively stripped from the expression by the Python Regular 
Expression Compiler because it is redundant.  The same goes for 
expressions of the form (x*)* (issue 2537).  Also, there is a problem 
with expressions of the form (x*){n,m} (issue 1633953), since the x* 
matches as much as it can, and thus it sees the range repeat operation 
as redundant -- in this case I think the range repeat should have the 
effect of matching (x*)(x*)(x*)... n to m times, but since the first 
time matches everything, the subsequent matches all match zero-width 
expressions following the first one.  I am tracking all of these issues 
under Item 33 of Issue 2636.

The are the 3 known redundant repeat issues, but this one, the zero-or-
one followed by zero-or-one is AFAICT fixed in python 2.6 as the 
expression originally listed now passes compile.

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


More information about the Python-bugs-list mailing list