[issue11665] Regexp findall freezes
STINNER Victor
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 :-)
https://bitbucket.org/haypo/hachoir/wiki/hachoir-regex
----------
nosy: +haypo
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11665>
_______________________________________
More information about the Python-bugs-list
mailing list