Towards Efficient Matching of Regexes with Backreferences using Register Set Automata
Vojtech Havlena, Lukás Holík, Ondrej Lengál, Jan Vasák, Sabína Gulcíková
摘要
Matching regexes (regular expressions) is a common problem in many areas of computer science, with requirements on high speed and robust performance. Regexes with backreferences allow one to express certain patterns (even beyond regular) concisely, however, since the matching is usually done by backtracking, the matching speed can degrade to a degree that constitutes a service failure or a security threat. To facilitate highspeed matching of such regexes, we propose register set automata (RSAs), an extension of register automata where registers can contain sets of symbols (from a potentially infinite alphabet) and the following operations are supported: adding input values to registers, merging or clearing registers, and testing whether a register contains a value. We show that a large class of register automata can be transformed into deterministic RSAs, which can serve as a basis for fast matching of a family of regexes with single-letter capture groups and backreferences. We also give a derivative-based algorithm for transforming a large class of regexes with backreferences to register automata and show that the time complexity of matching is linear and quadratic to the length of the input for finite and infinite alphabets respectively. Our prototype implementation of a regex matcher shows that our approach can significantly improve the robustness of state-of-the-art regex matchers on regexes with backreferences. We also study the theoretical properties of the model and show that the emptiness problem for RSAs is decidable and complete for the F ω class and that RSAs are incomparable in expressive power to other popular automata models over data words.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
脉络
- Linear Matching of JavaScript Regular Expressions 引用了 Regex matching with counting-set automata
- Linear Matching of JavaScript Regular Expressions 引用了 Revealer: Detecting and Exploiting Regular Expression Denial-of-Service Vulnerabilities
- Exploiting Input Sanitization for Regex Denial of Service 引用了 Regex matching with counting-set automata
- Exploiting Input Sanitization for Regex Denial of Service 引用了 Revealer: Detecting and Exploiting Regular Expression Denial-of-Service Vulnerabilities
- Software-hardware codesign for efficient in-memory regular pattern matching 引用了 Regex matching with counting-set automata
它引用的 Paper11
- Revealer: Detecting and Exploiting Regular Expression Denial-of-Service VulnerabilitiesYinxi Liu, Mingxue Zhang, Wei MengS&P 2021 · 28 次引用
- Software-hardware codesign for efficient in-memory regular pattern matchingLingkun Kong, Qixuan Yu, Agnishom Chattopadhyay, Alexis Le Glaunec 等PLDI 2022 · 23 次引用
- Regex matching with counting-set automataLenka Turonová, Lukás Holík, Ondrej Lengál, Olli Saarikivi 等OOPSLA 2020 · 22 次引用
- Exploiting Input Sanitization for Regex Denial of ServiceEfe Barlas, Xin Du, James C. DavisICSE 2022 · 16 次引用
- Linear Matching of JavaScript Regular ExpressionsAurèle Barrière, Clément Pit-ClaudelPLDI 2024 · 11 次引用
相关 Paper
- Sparse Regular Expression MatchingPhilip Bille, Inge Li GørtzSODA 2024 · 2 次引用
- Regular Expression Matching using Bit Vector AutomataAlexis Le Glaunec, Lingkun Kong, Konstantinos MamourasOOPSLA 2023 · 22 次引用
- Efficient Matching of Regular Expressions with Lookaround AssertionsKonstantinos Mamouras, Agnishom ChattopadhyayPOPL 2024 · 19 次引用
- RE#: High Performance Derivative-Based Regex Matching with Intersection, Complement, and Restricted LookaroundsIan Erik Varatalu, Margus Veanes, Juhan P. ErnitsPOPL 2025 · 9 次引用
- Orbit-Finite-Dimensional Vector Spaces and Weighted Register AutomataMikolaj Bojanczyk, Bartek Klin, Joshua MoermanLICS 2021 · 5 次引用
