[issue11665] Regexp findall freezes
report at bugs.python.org
Fri Mar 25 00:07:00 CET 2011
STINNER Victor <victor.stinner at haypocalc.com> added the comment:
If I read correctly '(<(?:(?:[^<>]*)|(?:"[^"]*"))*>)', it is something like (A*|B)*. Regex like (A*)* is *very* slow. It can easily be optimized to A*. Or for (A*|B)* => (A|B)*.
So '(<(?:(?:[^<>]*)|(?:"[^"]*"))*>)' can be optimized to '(<(?:(?:[^<>])|(?:"[^"]*"))*>)'.
I hope that it does match the same thing :-)
I wrote a library to optimize regular expression, but you are unliky: it doesn't support (?:...) yet :-)
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list