[Python-bugs-list] [Bug #127259] New re breaks on some '*?' matches

noreply@sourceforge.net noreply@sourceforge.net
Mon, 01 Jan 2001 20:37:07 -0800


Bug #127259, was updated on 2001-Jan-01 20:37
Here is a current snapshot of the bug.

Project: Python
Category: Regular Expressions
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Submitted by: nobody
Assigned to : nobody
Summary: New re breaks on some '*?' matches

Details: New python library:

Python 2.0 (#2, Nov 29 2000, 07:33:50) 
[GCC 2.96 20000731 (Red Hat Linux 7.0)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import re
>>> re.match("a[ ]*?\ (\d+)", "a   10")
<SRE_Match object at 0x81db748>
>>> re.match("a[ ]*?\ (\d+)", "a    10")

Old python library:
Python 1.5.2 (#1, Aug 25 2000, 09:33:37)  [GCC 2.96 20000731
(experimental)] on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import re
>>> re.match("a[ ]*?\ (\d+)", "a   10")
<re.MatchObject instance at 80dc1e0>
>>> re.match("a[ ]*?\ (\d+)", "a    10")
<re.MatchObject instance at 80d9c88>
>>> 

I see no reason why the second line should not match.  (IE.
the old regular expression library seems correct to me.)

Ok, "so don't do that" - well I encountered it in code that
autogenerates regular expressions, so it isn't so easy to
always avoid.  Besides, it doesn't look correct to me.

Thanks,
-Kevin (kevoc@bellatlantic.net)


For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=127259&group_id=5470