Lune

SODA2024Top-tier venue

Sparse Regular Expression Matching

Philip Bille, Inge Li Gørtz

2024Year
2Citations

Abstract

A regular expression specifies a set of strings formed by single characters combined with concatenation, union, and Kleene star operators. Given a regular expression R and a string Q, the regular expression matching problem is to decide if Q matches any of the strings specified by R. Regular expressions are a fundamental concept in formal languages and regular expression matching is a basic primitive for searching and processing data. A standard textbook solution [Thompson, CACM 1968] constructs and simulates a nondeterministic finite automaton, leading to an O(nm) time algorithm, where n is the length of Q and m is the length of R. Despite considerable research efforts only polylogarithmic improvements of this bound are known. Recently, conditional lower bounds provided evidence for this lack of progress when Backurs and Indyk [FOCS 2016] proved that, assuming the strong exponential time hypothesis (SETH), regular expression matching cannot be solved in O((nm) 1-ϵ ), for any constant ϵ > 0. Hence, the complexity of regular expression matching is essentially settled in terms of n and m.

In this paper, we take a new approach and introduce a density parameter, ∆, that captures the amount of nondeterminism in the NFA simulation on Q. The density is at most nm + 1 but can be significantly smaller. Our main result is a new algorithm that solves regular expression matching in O ∆ log log nm ∆ + n + m time. This essentially replaces nm with ∆ in the complexity of regular expression matching. We complement our upper bound by a matching conditional lower bound that proves that we cannot solve regular expression matching in time O(∆ 1-ϵ ) for any constant ϵ > 0 assuming SETH.

The key technical contribution in the result is a new linear space representation of the classic position automaton that supports fast state-set transition computation in near-linear time in the size of the input and output state sets. To achieve this, we develop several new insights and techniques of independent interest, including new structural properties of the parse trees of regular expressions, a decomposition of state-set transitions based on parse trees, and a fast batched predecessor data structure.

Ask about this paper

Your agent reads all of it.

Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.

Questions to start from

Your agent calls

Luneget_paper_fulltext

Ask in Lune

Free to start. No credit card required.

lune papers fulltext e20b5069-3852-4adf-9ad5-d1eff091bfbe

Builds on1

Related papers

Dusk over the sea between two cliffs drawn in fine vertical lines