Skip to content
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

Fix FastRegexMatcher to skip nested capture groups #577

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

pracucci
Copy link
Collaborator

FastRegexMatcher ignores capture group by design. This is done calling clearCapture(). However, clearCapture() removes a single capture group. This means that when a regexp has nested capture groups (e.g. ((a|b))) the optimization doesn't trigger because we remove the 1st capture group but not the 2nd (nested) one.

This PR fixes it. To clarify, this is not a logic bug, but we're missing the opportunity to optimize regexp with nested capture groups.

Signed-off-by: Marco Pracucci <marco@pracucci.com>
Copy link
Contributor

@bboreham bboreham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@pracucci pracucci merged commit 12d2c10 into main Dec 20, 2023
6 checks passed
@pracucci pracucci deleted the fix-regexp-optimization-with-double-capture-group branch December 20, 2023 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants