This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author loewis
Recipients
Date 2000-09-11.08:24:15
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
[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)...
History
Date User Action Args
2007-08-23 13:50:29adminlinkissue214033 messages
2007-08-23 13:50:29admincreate