Python regular expression

Wehrdamned macygasp at gmail.com
Tue Dec 5 04:52:15 EST 2006


Hi,

As I understand it, python uses a pcre engine to work with regular
expression.
My question is, then, why expressions like :

>>> re.compile('asd|(?-i:QWE)', re.I)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/sre.py", line 180, in compile
    return _compile(pattern, flags)
  File "/usr/lib/python2.4/sre.py", line 227, in _compile
    raise error, v # invalid expression
sre_constants.error: unexpected end of pattern

don't work? They are ok in perl... 

Thanks in advance.




More information about the Python-list mailing list