Abstract

Finding substrings of a text T that match a regular expression p is a fundamental problem. Despite being the subject of extensive research, no solution with a time complexity significantly better than O(|T||p|) has been found. Backurs and Indyk in FOCS 2016 established conditional lower bounds for the algorithmic problem based on the Strong Exponential Time Hypothesis that helps explain this difficulty. A natural question is whether we can improve the time complexity for matching the regular expression by preprocessing the text T? We show that conditioned on the Online Matrix–Vector Multiplication (OMv) conjecture, even with arbitrary polynomial preprocessing time, a regular expression query on a text cannot be answered in strongly sublinear time, i.e., O(|T|1−ε) for any ε>0. Furthermore, if we extend the OMv conjecture to a plausible conjecture regarding Boolean matrix multiplication with polynomial preprocessing time, which we call Online Matrix–Matrix Multiplication (OMM), we can strengthen this hardness result to there being no solution with a query time that is O(|T|3/2−ε). These results hold for alphabet sizes three or greater. We then provide data structures that answer queries in O(|T||p|τ) time where τ∈[1,|T|] is fixed at construction. These include a solution that works for all regular expressions with Expτ·|T| preprocessing time and space. For patterns containing only ‘concatenation’ and ‘or’ operators (the same type used in the hardness result), we provide (1) a deterministic solution which requires Expτ·|T|log2|T| preprocessing time and space, and (2) when |p|≤|T|z for z=2o(log|T|), a randomized solution with amortized query time which answers queries correctly with high probability, requiring Expτ·|T|2Ωlog|T| preprocessing time and space.

Highlights

  • The ability to search for substrings matching a regular expression in preprocessed text is useful in countless applications

  • If we extend the OMv conjecture to a plausible conjecture regarding Boolean matrix multiplication with polynomial preprocessing time, which we call Online Matrix–Matrix

  • This list includes regular expression engines built into software packages and programming languages [1,2,3,4,5,6], those used within search engines for code repositories [7,8,9], and more generally, engines used for searching through string fields in database systems like SQL and non-relational databases [10,11,12]

Read more

Summary

Introduction

The ability to search for substrings matching a regular expression in preprocessed text is useful in countless applications. We discuss some of the problems used to prove the results stated above, along with the related conjectures and background These reductions will all use a similar theme, that is, a connection between matching a regular expression to a text and the multiplication of two Boolean vectors. The Online Boolean Matrix–Vector Multiplication problem cannot be solved in strongly subcubic time, O(n3−ε ) for any ε > 0, using purely combinatorial methods, even with arbitrary polynomial-time preprocessing. This conjecture was first introduced in [14] and has grown in popularity in recent years. We preprocess solutions to small regular expressions and provide a way in which these preprocessed solutions can be merged to form the final query response

Background and Related Work
Hardness of Creating an Index for Regular Expression Queries
Hardness Based on OMv
Hardness Based on OMM
A Regular Expression Index
Solution Graphs
Precomputed Solutions
Constructing the Solution Graph at Query Time
Querying Matches via Graph Traversal
Restricted Regular Expressions
Preserving High Probability of Success
Findings
Discussion
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call