Lune

OOPSLA2023Top-tier venue

Regular Expression Matching using Bit Vector Automata

Alexis Le Glaunec, Lingkun Kong, Konstantinos Mamouras

Abstract

Regular expressions (regexes) are ubiquitous in modern software. There is a variety of implementation techniques for regex matching, which can be roughly categorized as (1) relying on backtracking search, or (2) being based on finite-state automata. The implementations that use backtracking are often chosen due to their ability to support advanced pattern-matching constructs. Unfortunately, they are known to suffer from severe performance problems. For some regular expressions, the running time for matching can be exponential in the size of the input text. In order to provide stronger guarantees of matching efficiency, automata-based regex matching is the preferred choice. However, even these regex engines may exhibit severe performance degradation for some patterns. The main reason for this is that regexes used in practice are not exclusively built from the classical regular constructs, i.e., concatenation, nondeterministic choice and Kleene's star. They involve additional constructs that provide succinctness and convenience of expression. The most common such construct is bounded repetition (also called counting), which describes the repetition of the pattern a fixed number of times.

In this paper, we propose a new algorithm for the efficient matching of regular expressions that involve bounded repetition. Our algorithms are based on a new model of automata, which we call nondeterministic bit vector automata (NBVA). This model is chosen to be expressively equivalent to nondeterministic counter automata with bounded counters, a very natural model for expressing patterns with bounded repetition. We show that there is a class of regular expressions with bounded repetition that can be matched in time that is independent from the repetition bounds. Our algorithms are general enough to cover the vast majority of challenging bounded repetitions that arise in practice. We provide an implementation of our approach in a regex engine, which we call BVA-Scan. We compare BVA-Scan against state-of-the-art regex engines on several real datasets.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

12 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • HybridSA: GPU Acceleration of Multi-pattern Regex Matching using Bit Parallelism cites BVAP: Energy and Memory Efficient Automata Processing for Regular Expressions with Bounded Repetitions
  • HybridSA: GPU Acceleration of Multi-pattern Regex Matching using Bit Parallelism cites Software-hardware codesign for efficient in-memory regular pattern matching
  • HybridSA: GPU Acceleration of Multi-pattern Regex Matching using Bit Parallelism cites Efficient Matching of Regular Expressions with Lookaround Assertions
  • Linear Matching of JavaScript Regular Expressions cites Regex matching with counting-set automata
  • Linear Matching of JavaScript Regular Expressions cites Efficient Matching of Regular Expressions with Lookaround Assertions
  • BVAP: Energy and Memory Efficient Automata Processing for Regular Expressions with Bounded Repetitions cites Software-hardware codesign for efficient in-memory regular pattern matching
  • BVAP: Energy and Memory Efficient Automata Processing for Regular Expressions with Bounded Repetitions cites Regex matching with counting-set automata
  • BVAP: Energy and Memory Efficient Automata Processing for Regular Expressions with Bounded Repetitions cites Efficient Matching of Regular Expressions with Lookaround Assertions
  • Software-hardware codesign for efficient in-memory regular pattern matching cites Regex matching with counting-set automata
  • RE#: High Performance Derivative-Based Regex Matching with Intersection, Complement, and Restricted Lookarounds cites Linear Matching of JavaScript Regular Expressions
  • RE#: High Performance Derivative-Based Regex Matching with Intersection, Complement, and Restricted Lookarounds cites Regex matching with counting-set automata
  • RE#: High Performance Derivative-Based Regex Matching with Intersection, Complement, and Restricted Lookarounds cites Efficient Matching of Regular Expressions with Lookaround Assertions
  • Efficient Matching of Regular Expressions with Lookaround Assertions cites Software-hardware codesign for efficient in-memory regular pattern matching
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers12

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

Builds on2

  1. Software-hardware codesign for efficient in-memory regular pattern matchingLingkun Kong, Qixuan Yu, Agnishom Chattopadhyay, Alexis Le Glaunec et al.PLDI 2022 · 23 citations
  2. Regex matching with counting-set automataLenka Turonová, Lukás Holík, Ondrej Lengál, Olli Saarikivi et al.OOPSLA 2020 · 22 citations

Related papers

  1. RAP: Reconfigurable Automata ProcessorZiyuan Wen, Alexis Le Glaunec, Konstantinos Mamouras, Kaiyuan YangISCA 2025 · 2 citations
  2. 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
  3. Towards Efficient Matching of Regexes with Backreferences using Register Set AutomataVojtech Havlena, Lukás Holík, Ondrej Lengál, Jan Vasák et al.PLDI 2026
  4. Exploiting Structure in Regular Expression QueriesLing Zhang, Shaleen Deep, Avrilia Floratou, Anja Gruenheid et al.SIGMOD 2023 · 3 citations
  5. Sparse Regular Expression MatchingPhilip Bille, Inge Li GørtzSODA 2024 · 2 citations
Dusk over the sea between two cliffs drawn in fine vertical lines