[issue29977] re.sub stalls forever on an unmatched non-greedy case

Serhiy Storchaka report at bugs.python.org
Tue Apr 4 04:09:37 EDT 2017


Serhiy Storchaka added the comment:

This is a well known issue called catastrophic backtracking. It can't be solved with the current implementation of the regular expression engine. The best you can rewrite your regular expression. Even replacing "(.|\s)" with just "." can help.

----------
nosy: +serhiy.storchaka
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29977>
_______________________________________


More information about the Python-bugs-list mailing list