re.compile bug?

John Dell'Aquila dellaq2 at pdq.net
Fri Dec 14 09:58:55 EST 2001


Compilation fails with VERBOSE flag but works otherwise.

bash-2.05$ python
ActivePython 2.1.1, build 212 (ActiveState)
Python 2.1.1 (#20, Jul 26 2001, 11:38:51) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> import re
>>> comment = "([^#]*)(#.*)?$"
>>> re.compile(comment)
<SRE_Pattern object at 00814050>
>>> re.compile(comment, re.VERBOSE)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "d:\PYTHON21\lib\sre.py", line 90, in compile
    return _compile(pattern, flags)
  File "d:\PYTHON21\lib\sre.py", line 136, in _compile
    raise error, v # invalid expression
sre_constants.error: unbalanced parenthesis
>>>
--
John Dell'Aquila



More information about the Python-list mailing list