Get the latest tech news
Adding lookbehinds to rust-lang/regex
An annotated guide to adding captureless lookbehinds to the Rust linear-time regex engine.
The reason the problem described above with scanning to the end unnecessarily actually became apparent during benchmarking match-all searches, in which the regex engine returns all non-overlapping matches found in the string. The comparison between our modified version and the original crate showed no significant slowdowns, which leads us to believe that we were successful in implementing lookbehinds in a way that does not cause a downside to regexes that don't need the feature. My guess for why this isn't a problem per se is that it only materializes when the amount of matches is very close to the size of the haystack and in that case, usually the regex is so simple that it can easily be handled by the other engines and there's no need to fall back to the backtracker or even PikeVM.
Or read this on Hacker News