English

New Algorithms for Regular Expression Matching

Data Structures and Algorithms 2007-05-23 v1

Abstract

In this paper we revisit the classical regular expression matching problem, namely, given a regular expression RR and a string QQ, decide if QQ matches one of the strings specified by RR. Let mm and nn be the length of RR and QQ, respectively. On a standard unit-cost RAM with word length wlognw \geq \log n, we show that the problem can be solved in O(m)O(m) space with the following running times: \begin{equation*} \begin{cases} O(n\frac{m \log w}{w} + m \log w) & \text{if m>wm > w} \\ O(n\log m + m\log m) & \text{if w<mw\sqrt{w} < m \leq w} \\ O(\min(n+ m^2, n\log m + m\log m)) & \text{if mwm \leq \sqrt{w}.} \end{cases} \end{equation*} This improves the best known time bound among algorithms using O(m)O(m) space. Whenever wlog2nw \geq \log^2 n it improves all known time bounds regardless of how much space is used.

Keywords

Cite

@article{arxiv.cs/0606116,
  title  = {New Algorithms for Regular Expression Matching},
  author = {Philip Bille},
  journal= {arXiv preprint arXiv:cs/0606116},
  year   = {2007}
}