Issue 470582: sre bug with nested groups (original) (raw)
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