Faster Regular Expression Matching via Two-Dimensional Tabulation
arXiv:2611.04852
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 and a string , the classic regular expression matching problem is to decide whether matches any string specified by . Let and be the lengths of and , respectively. Our main result is a new algorithm that, given a parameter , solves the problem in \[ O\left(\frac{nm\,\lg\lg(t/m)}{\lg^2(t/m)}+t+n\right) \] time and words of space. In particular, for any fixed $0<\eps<1$, when $m\leq n^{1-\eps}$, we solve the problem in time and space. Compared to the previous best result [Bille and Thorup, ICALP 2009], this improves the leading term by a factor . The key new technique is a two-dimensional tabulation specialized to the regular expression.