[issue46627] Regex hangs indefinitely

J.B. Langston report at bugs.python.org
Thu Feb 3 14:31:48 EST 2022


J.B. Langston <jblangston at datastax.com> added the comment:

Yes, it is supposed to match everything up to the closing ] in this substring: 

[BigTableReader(path='/data/cassandra/data/log/logEntry_202202-e68971800b2711ecaf770d5fa3f5ae87/md-112-big-Data.db')]

Quoting from the re docs:

To match a literal ']' inside a set, precede it with a backslash, or place it at the beginning of the set. For example, both [()[\]{}] and []()[{}] will both match a parenthesis.

The docs don't specifically state the case of a negated set using ^, but I have used this construction many times and never had a problem with it.

Furthermore, it is not what caused the regex to hang.  That was caused by "(?P<biggest_size>[^,]+)," and changing it to "(?P<biggest_size>.+?)," fixed the problem.

----------

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


More information about the Python-bugs-list mailing list