[Python-bugs-list] [ python-Bugs-470582 ] sre bug with nested groups

noreply@sourceforge.net noreply@sourceforge.net
Fri, 12 Oct 2001 07:23:34 -0700


Bugs item #470582, was opened at 2001-10-12 07:23
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=470582&group_id=5470

Category: Regular Expressions
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Markus F.X.J. Oberhumer (mfx)
Assigned to: Fredrik Lundh (effbot)
Summary: sre bug with nested groups

Initial Comment:
sre incorrectly assigns non-matched inner groups.

See m.group(2) in the example below.

This bug seems to be present in all sre versions
(tested with python 1.6.x, 2.0.x, 2.1.x and 2.2a4).

Markus

P.S. this seems not related to SF bug #468169



Script started on Tue Oct  9 05:09:28 2001
mfx@laetitia:~/tmp > cat sre_bug.py
import sys, pre, sre

def time2ms(re, time):
    m = re.search(r"^((\d)\:)?(\d\d)\.(\d\d\d)$", time)
    print re.__name__
    if hasattr(re, "__version__"):
        print re.__version__
    print m.groups()

print sys.version
time2ms(pre, "34.123")
time2ms(sre, "34.123")

mfx@laetitia:~/tmp > pyhon2.2a4 sre_bug.py

2.2a4 (#1, Sep 29 2001, 23:40:47)
[GCC 2.95.4 20010902 (Debian prerelease)]
pre
(None, None, '34', '123')
sre
2.1.1
(None, '3', '34', '123')

Script done on Tue Oct  9 05:09:45 2001


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=470582&group_id=5470