Improved Extended Regular Expression Matching

Abstract

An extended regular expression R specifies a set of strings formed by characters from an alphabet combined with concatenation, union, intersection, complement, and star operators. Given an extended regular expression R and a string Q, the extended regular expression matching problem is to decide if Q matches any of the strings specified by R. Extended regular expression matching was introduced by Hopcroft and Ullman in the 1970s, who gave a simple dynamic programming solution using O(n3m) time and O(n2m) space, where n is the length of Q and m is the length of R. The current state-of-the art solution, by Yamamoto and Miyazaki uses O(n3k + n2mw + n + m) time and O(n2k + nmw + n + m) space, where k is the number of negation and complement operators in R and w is the number of bits in a machine word. This roughly replaces the m factor with k in the dominant terms of both the space and time bounds of the classical Hopcroft and Ullman algorithm. In this paper, we present a new solution that solves extended regular expression matching in \[ O(nω k + n2m(w/ w, n) + m) \] time and O(n2 kw + n + m) = O(n2 +m) space, where ω ≈ 2.3716 is the exponent of matrix multiplication. Essentially, this replaces the dominant n3k term with nω k in the time bound, while simultaneously improving the n2k term in the space to O(n2). To achieve our result, we develop several new insights and techniques of independent interest, including a new compact representation to store and efficiently combine substring matches, a new clustering technique for parse trees of extended regular expressions, and a new efficient combination of finite automaton simulation with substring match representation to speed up the classic dynamic programming solution.

0

Turn this paper into a full lesson

ArcXiv compiles a staged curriculum from this paper: 8-12 lessons across beginner → advanced, synthesised section guides, visuals, flashcards, a quiz, exercises, and on-demand deep dives per section. Grounded in the abstract, never invented.

Discussion (0)

Sign in to join the discussion.

Loading comments…