-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
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? Sign in to your account
0-infinite quantifier inside lookbehind causes catastrophic backtracking #278
Comments
(?<=ab+|a)c is transformed into (?:(?<=ab+)|(?<=a))c. |
sadly how does lookbehind work? I noticed limiting the possible length of the initial regex I had problems with was |
Look-behind is made as a type of anchor. Originally, it did not support variable length look-behind.
But I can't remember why I stopped this. |
I assume you stopped because using what optimizations are there around detecting I just tested with Is it possible to physically reverse the execution direction of the regex? |
No optimization exists for (?<=ab*). |
I just ran into a similar problem again here's a simplified regex however the regex surprisingly the regex the original regex I had a problem with |
I just found an interesting work around however it does mean, the regex must match at the start of the string possibly a more performant version of EDIT: |
I could not reproduce this slowing down. |
sorry If I double the so it's
I guess this doesn't matter too much; as it isn't catastrophic backtracking I'm just being a bit nitpicky |
original issue: microsoft/vscode-textmate#166
the regex
(?<=ab*)c
runs into catastrophic backtracking when matching against a long line ofc
'showever
(?<=ab+|a)c
does not have this issueThe text was updated successfully, but these errors were encountered: