[issue46825] slow matching on regular expression

Matthew Barnett report at bugs.python.org
Tue Feb 22 09:36:28 EST 2022


Matthew Barnett <python at mrabarnett.plus.com> added the comment:

The expression is a repeated alternative where the first alternative is a repeat. Repeated repeats can result in a lot of attempts and backtracking and should be avoided.

Try this instead:

    (0|1(01*0)*1)+

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46825>
_______________________________________


More information about the Python-bugs-list mailing list