Derivative Based Nonbacktracking Real-World Regex Matching with Backtracking Semantics
Dan Moseley, Mario Nishio, Jose Perez Rodriguez, Olli Saarikivi, Stephen Toub, Margus Veanes, Tiki Wan, Eric Xu
Abstract
We develop a new derivative based theory and algorithm for nonbacktracking regex matching that supports anchors and counting, preserves backtracking semantics, and can be extended with lookarounds. The algorithm has been implemented as a new regex backend in .NET and was extensively tested as part of the formal release process of .NET7. We present a formal proof of the correctness of the algorithm, which we believe to be the first of its kind concerning industrial implementations of regex matchers. The paper describes the complete foundation, the matching algorithm, and key aspects of the implementation involving a regex rewrite system, as well as a comprehensive evaluation over industrial case studies and other regex engines.
Ask about this paper
Ask your agent about it.
Lune has read the top-tier papers around this one, so every answer names the papers it rests on.
Your agent calls
Lunesearch_papers
Free to start. No credit card required.
Terminal
Install the CLIlune papers get d2480f89-29a3-41ae-8644-d0bc2ca30297Cited by top-tier papers7
- Efficient Matching of Regular Expressions with Lookaround AssertionsKonstantinos Mamouras, Agnishom ChattopadhyayPOPL 2024 · 19 citations
- Linear Matching of JavaScript Regular ExpressionsAurèle Barrière, Clément Pit-ClaudelPLDI 2024 · 11 citations
- RE#: High Performance Derivative-Based Regex Matching with Intersection, Complement, and Restricted LookaroundsIan Erik Varatalu, Margus Veanes, Juhan P. ErnitsPOPL 2025 · 9 citations
- Towards an Effective Method of ReDoS Detection for Non-backtracking EnginesWeihao Su, Hong Huang, Rongchen Li, Haiming Chen et al.USENIX Security 2024 · 4 citations
- Regex Decision Procedures in Extended RE#Ian Erik Varatalu, Margus Veanes, Ekaterina Zhuchko, Juhan P. ErnitsCAV 2025 · 3 citations
Related papers
- Formal Verification for JavaScript Regular Expressions: A Proven Mechanized Semantics and Its ApplicationsAurèle Barrière, Victor Deng, Clément Pit-ClaudelPOPL 2026
- Repairing Regular Expressions for ExtractionNariyoshi Chida, Tachio TerauchiPLDI 2023 · 9 citations
- Regular Expression Matching using Bit Vector AutomataAlexis Le Glaunec, Lingkun Kong, Konstantinos MamourasOOPSLA 2023 · 22 citations
- Counting in Regexes Considered Harmful: Exposing ReDoS Vulnerability of Nonbacktracking MatchersLenka Turonová, Lukás Holík, Ivan Homoliak, Ondrej Lengál et al.USENIX Security 2022
- REmatch: a novel regex engine for finding all matchesCristian Riveros, Nicolás Van Sint Jan, Domagoj VrgocVLDB 2023 · 10 citations
