Lune

POPL2024顶会

Efficient Matching of Regular Expressions with Lookaround Assertions

Konstantinos Mamouras, Agnishom Chattopadhyay

摘要

Regular expressions have been extended with lookaround assertions, which are subdivided into lookahead and lookbehind assertions. These constructs are used to refine when a match for a pattern occurs in the input text based on the surrounding context. Current implementation techniques for lookaround involve backtracking search, which can give rise to running time that is super-linear in the length of input text. In this paper, we first consider a formal mathematical semantics for lookaround, which complements the commonly used operational understanding of lookaround in terms of a backtracking implementation. Our formal semantics allows us to establish several equational properties for simplifying lookaround assertions. Additionally, we propose a new algorithm for matching regular expressions with lookaround that has time complexity 𝑂 (𝑚 • 𝑛), where 𝑚 is the size of the regular expression and 𝑛 is the length of the input text. The algorithm works by evaluating lookaround assertions in a bottom-up manner. Our algorithm makes use of a new notion of nondeterministic finite automata (NFAs), which we call oracle-NFAs. These automata are augmented with epsilon-transitions that are guarded by oracle queries that provide the truth values of lookaround assertions at every position in the text. We provide an implementation of our algorithm that incorporates three performance optimizations for reducing the work performed and memory used. We present an experimental comparison against PCRE and Java's regex library, which are state-of-the-art regex engines that support lookaround assertions. Our experimental results show that, in contrast to PCRE and Java, our implementation does not suffer from super-linear running time and is several times faster.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 10 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • HybridSA: GPU Acceleration of Multi-pattern Regex Matching using Bit Parallelism 引用了 BVAP: Energy and Memory Efficient Automata Processing for Regular Expressions with Bounded Repetitions
  • HybridSA: GPU Acceleration of Multi-pattern Regex Matching using Bit Parallelism 引用了 Software-hardware codesign for efficient in-memory regular pattern matching
  • HybridSA: GPU Acceleration of Multi-pattern Regex Matching using Bit Parallelism 引用了 Regular Expression Matching using Bit Vector Automata
  • Linear Matching of JavaScript Regular Expressions 引用了 Regular Expression Matching using Bit Vector Automata
  • Linear Matching of JavaScript Regular Expressions 引用了 Derivative Based Nonbacktracking Real-World Regex Matching with Backtracking Semantics
  • BVAP: Energy and Memory Efficient Automata Processing for Regular Expressions with Bounded Repetitions 引用了 Software-hardware codesign for efficient in-memory regular pattern matching
  • BVAP: Energy and Memory Efficient Automata Processing for Regular Expressions with Bounded Repetitions 引用了 Regular Expression Matching using Bit Vector Automata
  • Efficient Algorithms for the Uniform Tokenization Problem 引用了 Linear Matching of JavaScript Regular Expressions
  • Efficient Algorithms for the Uniform Tokenization Problem 引用了 BVAP: Energy and Memory Efficient Automata Processing for Regular Expressions with Bounded Repetitions
  • Efficient Algorithms for the Uniform Tokenization Problem 引用了 Software-hardware codesign for efficient in-memory regular pattern matching
  • Efficient Algorithms for the Uniform Tokenization Problem 引用了 Regular Expression Matching using Bit Vector Automata
  • RE#: High Performance Derivative-Based Regex Matching with Intersection, Complement, and Restricted Lookarounds 引用了 Linear Matching of JavaScript Regular Expressions
  • RE#: High Performance Derivative-Based Regex Matching with Intersection, Complement, and Restricted Lookarounds 引用了 Regular Expression Matching using Bit Vector Automata
  • RE#: High Performance Derivative-Based Regex Matching with Intersection, Complement, and Restricted Lookarounds 引用了 Derivative Based Nonbacktracking Real-World Regex Matching with Backtracking Semantics
  • Regular Expression Matching using Bit Vector Automata 引用了 Software-hardware codesign for efficient in-memory regular pattern matching
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper10

  1. Linear Matching of JavaScript Regular ExpressionsAurèle Barrière, Clément Pit-ClaudelPLDI 2024 · 11 次引用
  2. BVAP: Energy and Memory Efficient Automata Processing for Regular Expressions with Bounded RepetitionsZiyuan Wen, Lingkun Kong, Alexis Le Glaunec, Konstantinos Mamouras 等ASPLOS 2024 · 11 次引用
  3. RE#: High Performance Derivative-Based Regex Matching with Intersection, Complement, and Restricted LookaroundsIan Erik Varatalu, Margus Veanes, Juhan P. ErnitsPOPL 2025 · 9 次引用
  4. HybridSA: GPU Acceleration of Multi-pattern Regex Matching using Bit ParallelismAlexis Le Glaunec, Lingkun Kong, Konstantinos MamourasOOPSLA 2024 · 6 次引用
  5. Efficient Algorithms for the Uniform Tokenization ProblemAngela W. Li, Konstantinos MamourasOOPSLA 2025 · 3 次引用

它引用的 Paper3

  1. Software-hardware codesign for efficient in-memory regular pattern matchingLingkun Kong, Qixuan Yu, Agnishom Chattopadhyay, Alexis Le Glaunec 等PLDI 2022 · 23 次引用
  2. Regular Expression Matching using Bit Vector AutomataAlexis Le Glaunec, Lingkun Kong, Konstantinos MamourasOOPSLA 2023 · 22 次引用
  3. Derivative Based Nonbacktracking Real-World Regex Matching with Backtracking SemanticsDan Moseley, Mario Nishio, Jose Perez Rodriguez, Olli Saarikivi 等PLDI 2023 · 21 次引用

相关 Paper

  1. Formal Verification for JavaScript Regular Expressions: A Proven Mechanized Semantics and Its ApplicationsAurèle Barrière, Victor Deng, Clément Pit-ClaudelPOPL 2026
  2. Sparse Regular Expression MatchingPhilip Bille, Inge Li GørtzSODA 2024 · 2 次引用
  3. Membership Testing for Semantic Regular ExpressionsYifei Huang, Matin Amini, Alexis Le Glaunec, Konstantinos Mamouras 等PLDI 2025
  4. Towards Efficient Matching of Regexes with Backreferences using Register Set AutomataVojtech Havlena, Lukás Holík, Ondrej Lengál, Jan Vasák 等PLDI 2026
  5. Repairing Regular Expressions for ExtractionNariyoshi Chida, Tachio TerauchiPLDI 2023 · 9 次引用
黄昏的海面,两侧是细线勾勒的悬崖