Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
to your account
In order for catastrophic backtracking to occur there must be a character that forces backtracking to occur. E.g.
>>> re.match('(a+)+', 'a' * 64 + 'c')
<_sre.SRE_Match at 0x7f9106d32430>
>>> re.match('(a+)+b', 'a' * 64 + 'c')
The first expression has nested quantifiers, so Dlint will detect it, but since there's nothing after the nested quantifier to backtrack the match no catastrophic backtracking will occur. Similarly:
$ python -m dlint.redos -p '(a+)+'
$ python -m dlint.redos -p '(a+)+b'
We should avoid detecting the first expression because catastrophic backtracking cannot occur.
The text was updated successfully, but these errors were encountered:
No branches or pull requests