[Python-bugs-list] [Bug #114033] re incompatibility in sre
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 11 Sep 2000 01:24:15 -0700
Bug #114033, was updated on 2000-Sep-11 01:24
Here is a current snapshot of the bug.
Project: Python
Category: Modules
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Summary: re incompatibility in sre
Details: [submitted by Adam Sampson]
Under Python 1.5.2, I had a script containing the following line:
m = re.match(r"[a-z0-9]*://[^/]+/.*\.([^.#\?/]*)([#\?]?.*)?", url)
Under 1.6, this fails with:
[...]
File "/usr/local/lib/python1.6/sre.py", line 44, in match
return _compile(pattern, flags).match(string)
File "/usr/local/lib/python1.6/sre.py", line 102, in _compile
raise error, v # invalid expression
sre_constants.error: nothing to repeat
I can narrow it down to:
>>> m = re.match(r"(x?)?", url)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python1.6/sre.py", line 44, in match
return _compile(pattern, flags).match(string)
File "/usr/local/lib/python1.6/sre.py", line 102, in _compile
raise error, v # invalid expression
sre_constants.error: nothing to repeat
whereas:
>>> m = re.match(r"(x?.)?", url)
works fine. Is this correct behaviour for SRE, or am I just being stupid?
"(x?)?" looks like a perfectly reasonable Perl-style regexp to me (and Perl
too)...
For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=114033&group_id=5470