basic variable-sized lookbehind implementation#194
Merged
keith-hall merged 6 commits intomainfrom Oct 31, 2025
Merged
Conversation
use regex-automata's DFA reverse search functionality to support variable (even unbounded) length lookbehinds without fancy features or capture groups
- also improve error handling for when it fails to build a DFA - add benchmarks - update docs to mention the feature flag
- which allows us to have a debug formatting implementation for use in the toy example and playground
…okbehind if it matches once, it doesn't matter whether it will match more times or not, the end result is unaffected
keith-hall
commented
Oct 17, 2025
robinst
approved these changes
Oct 31, 2025
Contributor
robinst
left a comment
There was a problem hiding this comment.
LGTM, just one suggestion. Nice work!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
use regex-automata's DFA reverse search functionality to support variable (even unbounded) length lookbehinds without fancy features or capture groups. Partially fixes #74
Added benchmarks demonstrating that const-size lookbehinds are more efficient:
The variable-size implementation is about 3x slower but still very fast (sub-microsecond), confirming that the const-size optimization continues to work correctly and is worth keeping.
I created a feature flag for this, but I wasn't sure whether it should be part of the default features or not. Oniguruma does apparently support this, so I included it in the default features for now, but if someone has arguments for removing it, I'm happy to hear them.