A Dichotomy for Regular Expression Membership Testing
Authors:
- Karl BringmannKBKarl Bringmann
- Allan GronlundAGAllan Gronlund
- Kasper Green LarsenKLKasper Green Larsen
- 1 October 2017
- conference paper
- Published by Institute of Electrical and Electronics Engineers (IEEE)
- No. 02725428,p. 307-318
Abstract
We study regular expression membership testing: Given a regular expression of size m and a string of size n, decide whether the string is in the language described by the regular expression. Its classic O(nm) algorithm is one of the big success stories of the 70s, which allowed pattern matching to develop into the standard tool that it is today. Many special cases of pattern matching have been studied that can be solved faster than in quadratic time. However, a systematic study of tractable cases was made possible only recently, with the first conditional lower bounds reported by Backurs and Indyk [FOCS'16]. Restricted to any “type” of homogeneous regular expressions of depth 2 or 3, they either presented a near-linear time algorithm or a quadratic conditional lower bound, with one exception known as the Word Break problem. In this paper we complete their work as follows: (1) We present two almost-linear time algorithms that generalize all known almost-linear time algorithms for special cases of regular expression membership testing. (2) We classify all types, except for the Word Break problem, into almost-linear time or quadratic time assuming the Strong Exponential Time Hypothesis. This extends the classification from depth 2 and 3 to any constant depth. (3) For the Word Break problem we give an improved Õ(nm 1/3 + m) algorithm. Surprisingly, we also prove a matching conditional lower bound for combinatorial algorithms. This establishes Word Break as the only intermediate problem. In total, we prove matching upper and lower bounds for any type of bounded-depth homogeneous regular expressions, which yields a full dichotomy for regular expression membership testing.Keywords
All Related Versions
This publication has 18 references indexed in Scilit:
- Faster Regular Expression Matching2009
- Efficient algorithms for clique problemsInformation Processing Letters, 2009
- A new algorithm for optimal 2-constraint satisfaction and its implicationsTheoretical Computer Science, 2005
- On the complexity of fixed parameter clique and dominating setTheoretical Computer Science, 2004
- Verifying candidate matches in sparse and wildcard matching2002
- Which Problems Have Strongly Exponential Complexity?Journal of Computer and System Sciences, 2001
- On the Complexity of k-SATJournal of Computer and System Sciences, 2001
- On a class of O(n2) problems in computational geometryComputational Geometry, 1995
- A Four Russians algorithm for regular expression pattern matchingJournal of the ACM, 1992
- Fast Pattern Matching in StringsSIAM Journal on Computing, 1977