Pathological regular expression

franck pommereau at univ-paris12.fr
Fri Apr 17 16:48:06 EDT 2009


> To my mind, this is a bug in the RE engine. Is there any reason to not
> treat it as a bug?

It's not a bug, it's a feature! ;-)
Indeed, in order to handle constructs like (?P=name), RE engines have
to use inefficient algorithms. In my opinion, this is not the problem
of using a pathological regular expression, but rather a problem of
the RE engine that is not optimized to use the faster approach when
possible.

This is well known problem very well explained on:
http://swtch.com/~rsc/regexp/regexp1.html

Cheers,
Franck



More information about the Python-list mailing list