re difference between python 1.5 and python 2.1.2

Gillou nospam at bigfoot.com
Wed Feb 6 11:12:26 EST 2002


Hi,

I got a re that searches for FTP or HTTP URLs in a text.
This worked perfectly with python 1.5.2 but it raises an exception with
Python 2.1.2.
Other regular expressions I use work perfectly when running with Python
2.1.2.

Has anybody some hint ?

Thanks in advance.

--Gilles

>>> import re
>>> pat = re.compile(r'((ftp|http)://[\w-]+(?:\.[\w-]+)*(?:/[\w-\.?=]*)*)')
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\Python21\lib\sre.py", line 90, in compile
    return _compile(pattern, flags)
  File "C:\Python21\lib\sre.py", line 136, in _compile
    raise error, v # invalid expression
error: bad character range






More information about the Python-list mailing list