Look-behinds [1 / 6]: regex-syntax support#1315
Open
shilangyu wants to merge 4 commits intorust-lang:masterfrom
Open
Look-behinds [1 / 6]: regex-syntax support#1315shilangyu wants to merge 4 commits intorust-lang:masterfrom
shilangyu wants to merge 4 commits intorust-lang:masterfrom
Conversation
ConradIrwin
added a commit
to zed-industries/zed
that referenced
this pull request
Dec 4, 2025
Fancy regex has a max backtracking limit which defaults to 1,000,000 backtracks. This avoids spinning the CPU forever in the case that a match is taking a long time (though does mean that some matches may be missed). Unfortunately the verison we depended on causes an infinite loop when the backtracking limit is hit (fancy-regex/fancy-regex#137), so we got the worse of both worlds: matches were missed *and* we spun the CPU forever. Updating fixes this. Excitingly, in the future, regex may gain support for lookarounds (rust-lang/regex#1315), which will make fancy-regex much less load bearing. Closes #43821
ConradIrwin
added a commit
to zed-industries/zed
that referenced
this pull request
Dec 4, 2025
Fancy regex has a max backtracking limit which defaults to 1,000,000 backtracks. This avoids spinning the CPU forever in the case that a match is taking a long time (though does mean that some matches may be missed). Unfortunately the verison we depended on causes an infinite loop when the backtracking limit is hit (fancy-regex/fancy-regex#137), so we got the worse of both worlds: matches were missed *and* we spun the CPU forever. Updating fixes this. Excitingly regex may gain support for lookarounds (rust-lang/regex#1315), which will make fancy-regex much less load bearing. Closes #43821 Release Notes: - Fix a bug where search regexes with look-around or backreferences could hang the CPU. They will now abort after a certain number of match attempts.
AlpSha
pushed a commit
to AlpSha/zed
that referenced
this pull request
Dec 5, 2025
Fancy regex has a max backtracking limit which defaults to 1,000,000 backtracks. This avoids spinning the CPU forever in the case that a match is taking a long time (though does mean that some matches may be missed). Unfortunately the verison we depended on causes an infinite loop when the backtracking limit is hit (fancy-regex/fancy-regex#137), so we got the worse of both worlds: matches were missed *and* we spun the CPU forever. Updating fixes this. Excitingly regex may gain support for lookarounds (rust-lang/regex#1315), which will make fancy-regex much less load bearing. Closes zed-industries#43821 Release Notes: - Fix a bug where search regexes with look-around or backreferences could hang the CPU. They will now abort after a certain number of match attempts.
CherryWorm
pushed a commit
to CherryWorm/zed
that referenced
this pull request
Dec 16, 2025
Fancy regex has a max backtracking limit which defaults to 1,000,000 backtracks. This avoids spinning the CPU forever in the case that a match is taking a long time (though does mean that some matches may be missed). Unfortunately the verison we depended on causes an infinite loop when the backtracking limit is hit (fancy-regex/fancy-regex#137), so we got the worse of both worlds: matches were missed *and* we spun the CPU forever. Updating fixes this. Excitingly regex may gain support for lookarounds (rust-lang/regex#1315), which will make fancy-regex much less load bearing. Closes zed-industries#43821 Release Notes: - Fix a bug where search regexes with look-around or backreferences could hang the CPU. They will now abort after a certain number of match attempts.
someone13574
pushed a commit
to someone13574/zed
that referenced
this pull request
Dec 16, 2025
Fancy regex has a max backtracking limit which defaults to 1,000,000 backtracks. This avoids spinning the CPU forever in the case that a match is taking a long time (though does mean that some matches may be missed). Unfortunately the verison we depended on causes an infinite loop when the backtracking limit is hit (fancy-regex/fancy-regex#137), so we got the worse of both worlds: matches were missed *and* we spun the CPU forever. Updating fixes this. Excitingly regex may gain support for lookarounds (rust-lang/regex#1315), which will make fancy-regex much less load bearing. Closes zed-industries#43821 Release Notes: - Fix a bug where search regexes with look-around or backreferences could hang the CPU. They will now abort after a certain number of match attempts.
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.
Here is the first out of six PRs aiming to bring look-behinds to rust-regex. See #1266 for more information, notably the implementation plan.
In this PR we focus on adding look-behind support to the regex-syntax crate. New additions are hidden behind a feature flag to not break compatibility with other crates.
Currently the CI fails on generation of docsrs. This is due to all features being enabled during generation which breaks regex-automata. This will be fixed in the second PR which works on regex-automata.