Manuscript Offprint
arXiv:2611.04852Faster Regular Expression Matching via Two-Dimensional Tabulation
Abstract
Regular expression matching asks whether a string of length belongs to the language described by a regular expression of length . We give an algorithm that solves this problem in linear space and time. This improves the leading term of the previous best worst-case constant-alphabet time bound by a factor of . The key new technique is a two-dimensional tabulation specialized to the regular expression.
1 Introduction
A regular expression specifies a set of strings formed by characters from an alphabet combined with concatenation , union , and Kleene star () operators. For instance, describes the set of strings of and such that every is followed by an . Given a regular expression and string , the regular expression matching problem is to decide if matches any of the strings specified by . Regular expressions are a fundamental concept in formal language theory, introduced by Kleene in the 1950s [15], and regular expression matching is a basic tool in computer science for searching and processing text. Standard tools such as grep and sed provide direct support for regular expression matching in files, and the scripting language perl [23] is a full programming language that supports regular expression matching easily. Regular expression matching appears in many large-scale data processing applications, such as internet traffic analysis [13, 16, 24], data mining [11], databases [17, 19], computational biology [21], and human-computer interaction [14].
A classic textbook algorithm for regular expression matching, due to Thompson [22] from 1968, constructs and simulates a nondeterministic finite automaton (NFA) in time, where is the length of and is the total size of , counting each character symbol, occurrence of , and operator once. The simulation processes from left to right and computes a sequence of sets of states such that is the set of states in to which there is a path from the initial state that matches . In 1985 Galil [10] asked if a faster algorithm could be obtained. Subsequently, a sequence of results [4-7, 20] improved the bound using tabulation or word-level parallelism. In terms of and , the fastest known algorithm by Bille and Thorup [6] from 2009 achieves time.
More recently, several lower bounds suggest that polynomial improvements are not possible. First, Backurs and Indyk [3] showed in 2016 that we cannot solve regular expression matching in time , for , assuming the orthogonal vectors hypothesis (OVH) (see also Bringmann, Larsen, and Grønlund [8]). Then, in 2018 Abboud and Bringmann [1] showed that we cannot solve the problem in time , for , assuming the formula-SAT hypothesis (FSH) [1] (we note that neither OVH or FSH are immediately affected by the recent refutation of the exponential time hypothesis). Thus, the best known upper bound saves a factor of over the quadratic term , whereas the FSH-based lower bound only rules out savings of , leaving a substantial polylogarithmic gap.
Theorem 1 Let be a regular expression of length and let be a string of length . For any fixed and any integer , we can solve regular expression matching in
time and space.
In particular, setting , provided for a fixed , gives time and space. This improves the leading term of the previous best worst-case bound of Bille and Thorup [6] by a factor of . For constant-size alphabets, we obtain the stronger bound . This announcement focuses on the construction and proof for constant-size alphabets. The proof of the general-alphabet bound follows the same alphabet-encoding technique as in previous work [6] and will be added in a later version.
1.2 Techniques
We describe the main ideas for a constant-size alphabet. Thompson's simulation performs work for every combination of an automaton state and a text position. It is useful to distinguish improvements along the automaton dimension from improvements along both dimensions.
The one-dimensional speedup of Myers [20] and later algorithms [4,5] divides the automaton into small pieces and precomputes their behavior on one text character. A lookup processes an entire piece at once, while information is passed between pieces through their boundary states. This saves a logarithmic factor along the automaton dimension, but still processes the text one character at a time.
Bille and Thorup [6] extend this idea to two dimensions: each lookup processes an automaton piece on a short text string. The main difficulty is that matching paths can repeatedly leave a piece and return through its children. They summarize a child by the substrings it accepts, allowing complete child traversals to be replaced by shortcuts. A constant number of traversals of the decomposition then suffices to simulate the whole string. However, the child summaries describe quadratically many substrings in the string length. Fitting this information into the table input limits the text dimension to square-root logarithmic length, yielding an overall speedup.
Our approach keeps the decomposition and shortcut simulation, but builds tables specifically for the given regular expression. For every sufficiently short string, preprocessing determines the behavior of the children and incorporates it into the local tables. The child summaries therefore no longer need to be supplied as inputs during matching. We also express each phase as a union of simpler contributions, so each lookup needs only one state set or one set of prefix lengths. Together, these ideas allow both the automaton pieces and the text strings to have logarithmic size, yielding a squared-logarithmic speedup. The tables are specialized to the expression, whereas the universal tables of Bille and Thorup [6] can be reused across expressions.
1.3 Outline
Section 2 reviews regular expressions and finite automata. Section 3 presents the nested decomposition and shortcut micro TNFAs. Section 4 defines the micro TNFA functions and shows how to preprocess their tables. Section 5 describes the three-phase state-set simulation and establishes its correctness and implementation bounds. Finally, Section 6 combines these ingredients into the full algorithm and analyzes its time and space bounds.
1.4 AI Declaration
AI (ChatGPT 6) was used to produce an initial draft of the results based on extended discussions with the authors. The authors heavily edited this draft. AI was used for formatting and grammar editing.
2 Regular Expressions and Finite Automata
We briefly review the classical concepts used in the paper. For more details, see, e.g., Aho et al. [2].
Strings For a string , we write for the substring containing positions through , inclusive, where . We also set for . In particular, is the empty prefix.
Regular Expressions We consider regular expressions over an alphabet , defined recursively as follows. Each is a regular expression, where denotes the empty string. If and are regular expressions, then so are the concatenation , the union , and the star . We often omit the concatenation operator when writing regular expressions. The language generated by a regular expression is defined by for , , , and . Here concatenation of languages consists of all concatenations of a string from the first language and a string from the second, , and for .
The parse tree is the rooted ordered tree representing the recursive structure of . Its leaves are labeled by elements of , its unary nodes by , and its binary nodes by or . The length of counts each alphabet symbol, occurrence of , and operator once; equivalently, is the number of nodes of .
Finite Automata A nondeterministic finite automaton (NFA) is a tuple , where is a finite set of states, is a set of directed edges called transitions, is a set of start states, and is a set of accepting states. A transition goes from to and is labeled by . Thus is an edge-labeled directed graph with designated subsets of start and accepting states. An NFA is a deterministic finite automaton (DFA) if it has exactly one start state, no -transitions, and at most one outgoing transition with each character label from each state. We allow transitions to be undefined in a DFA.
Given a string and a path in , we say that and match if the concatenation of the transition labels along is . Paths may repeat vertices and transitions, and a path of length zero matches . We also say that two paths match if they match the same string. The set of strings matching some path from to is denoted by . For state sets , define
We identify a single state with its singleton set when using this notation. For a state set and any string , define the state-set transition
We write . In particular, is the epsilon closure of S, including S itself. Paths matching a character may include -transitions before and after the character transition.
The automaton accepts a string if a path from a state in to a state in matches ; otherwise it rejects . For of length , compute
Then accepts if and only if , including when .

Figure 1: Thompson's recursive NFA construction. The regular expression for a character corresponds to NFA (a). If S and T are regular expressions then , , and correspond to NFAs (b), (c), and (d), respectively. In each of these figures, the leftmost state and rightmost state are the start and accepting states, respectively. For the top recursive calls, these are the start and accepting states of the overall automaton. In the recursions indicated, e.g., for in (b), we take the start state of the subautomaton and identify with the state immediately to the left of in (b). Similarly the accepting state of is identified with the state immediately to the right of in (b).
Thompson's Automata Given a regular expression , an NFA accepting precisely can be obtained by several classic methods [12,18,22]. In particular, Thompson [22] gave the construction in Fig. 1. For the expression , use two distinct states joined by an -transition. We call an automaton constructed by these rules a Thompson NFA (TNFA) and denote the TNFA for by . Each TNFA has a single start state and a single accepting state ; thus and . We use subscripts to identify the automaton when needed.
A TNFA for an expression of length has at most states and at most transitions, and can be constructed in time. Epsilon closure can be computed by a multi-source breadth-first search restricted to -transitions. To compute for a character , first take the epsilon closure of , follow all transitions labeled from that set, and take the epsilon closure of the resulting states. Each step takes time for a TNFA. Hence, including construction and the initial epsilon closure, acceptance of a string of length can be tested in time and space. For , the time bound is . This is Thompson's algorithm [22].
3 Automata Techniques
3.1 Nested Decomposition
Let be a regular expression and let be its TNFA. We define a nested decomposition of following Bille [4]. A cluster is a connected subgraph of the parse tree , and a cluster partition is a partition of the nodes of into node-disjoint clusters. Edges joining different clusters are external edges, and all other edges are internal edges. Contracting the internal edges gives a macro tree with one node for each cluster. The parent, child, root, and leaf relationships between clusters are those of their corresponding nodes in the macro tree.
Fix a character . For each cluster with child clusters , insert a pseudo-node labeled on the external edge joining to . Let be the tree induced by the nodes of and . This is a parse tree for a regular expression over . The TNFA corresponding to is , which we call a micro TNFA. The set
is a nested decomposition of . We use the terms parent, child, root, and leaf for these micro TNFAs as for their clusters.
In a parent micro TNFA , each child micro TNFA is represented by its start and accepting states and and a pseudo-transition labeled from to . These two states are shared by and .
Recursively replacing the pseudo-transitions by the TNFAs they represent, identifying the shared states, recovers .
The following lemma is the decomposition lemma of Bille [4] with the binary-tree restriction used by Bille and Thorup [6]. The latter follows from Frederickson's tree partition technique [9].
Lemma 1 Given a regular expression of length and an integer , we can construct in time a nested decomposition of such that
-
,
-
each micro TNFA in has at most states, and
-
each micro TNFA in has at most two children.
In particular, the decomposition tree has maximum degree at most three.
Proof. Set . Apply Frederickson's tree partition technique [9] to the binary parse tree , as in Bille and Thorup [6, Section 4]. In time this gives a partition into node-disjoint clusters, each with at most nodes and at most two child clusters. Form the nested decomposition from this partition as above. Each cluster contributes one micro TNFA, so , and the parent-child relationships are preserved.
For a cluster , the augmented parse tree has at most nodes, including its at most two pseudo-nodes. Thompson's construction uses at most two states per parse-tree node, so the corresponding micro TNFA has at most states. Finally, constructing all augmented parse trees and their micro TNFAs takes total time, since the clusters partition and there is one pseudo-node per edge of the macro tree.
For we distinguish the local micro TNFA , in which a child is represented by its pseudo-transition from to , from the expanded TNFA obtained by recursively replacing all descendant pseudo-transitions. The interface states of a child are shared with its parent as described above. The construction has the following interface property: transitions from outside into its interior pass through its start state , and paths from its interior to the outside pass through its accepting state . Indeed, the expanded TNFA replaces a single pseudo-transition, and its start and accepting states are its only interfaces with the surrounding automaton. Write and for the states of the local and expanded TNFAs, respectively. For a state set , define its restrictions by and . Thus also includes states in descendants of . We write for the local restriction of the current state set .
3.2 Shortcut Micro TNFAs
Let be the nested decomposition from Lemma 1 with parameter . We use the local and expanded TNFAs and state-set restrictions defined in Section 3.1. State sets are stored as consistent local bitmaps at shared states.
A string-labeled automaton is a finite directed multigraph with designated sets of start and accepting states, whose transitions are labeled by strings in , including . Parallel transitions are allowed. A path matches the concatenation of its transition labels, and a path of length zero matches . The definitions of and from Section 2 extend directly to these automata. If a label is stored as a substring occurrence, its indices specify the stored occurrence; matching uses the string it spells. We use the path-based definition of , since the character-by-character simulation in Section 2 does not directly apply to string-labeled transitions. We also generalize TNFAs to allow string-labeled transitions in place of child pseudo-transitions, as in the shortcut micro TNFA defined below.
Fix a nonnegative integer and a string of characters. We represent prefixes by their lengths , with length 0 denoting the empty prefix. A set of prefix lengths is encoded by an -bit bitmap, and by a bitmap with at most bits. We use the path-language notation from Section 2.
For and the string , define the shortcut micro TNFA following Bille and Thorup [6, Section 4.1]. It has the local states of , with start state and accepting state , and retains all local character and epsilon transitions. For each child , replace the -transition by an edge
If accepts , also add a single epsilon edge from to . Thus only child pseudo-transitions are replaced; no other shortcut edges are added. A nonempty substring label is stored by its indices , without copying the string. Distinct occurrences may give parallel edges spelling the same string. The empty label is represented once, using .
For local states and , , we have
Indeed, each traversal of an expanded child along a matching path can be replaced by its shortcut edge, and each shortcut edge can be expanded into a matching path through that child. Local transitions are unchanged. This also handles empty paths and repeated child traversals.
For every and every substring of , including , the shortcut micro TNFA satisfies
Indeed, every edge of represents a path in , so expanding the edges of a matching path proves one inclusion. Conversely, replacing each complete child traversal in a path through by a shortcut gives a matching path in , proving the other inclusion.
Lemma 2 Let belong to a nested decomposition satisfying Lemma 1 with parameter , and let have length . The shortcut micro TNFA has at most states and transitions. Given the shortcut micro TNFAs for the children of , it can be constructed in time and words of workspace, including the output. If the accepted substring indices for each child have already been computed, construction takes time and space.
Proof. The local micro TNFA has transitions. Each of its at most two children contributes at most nonempty substring edges and one epsilon edge. This gives the size bound and the construction bound when the accepted substring indices are known.
To obtain these indices from a child shortcut micro TNFA , temporarily make a copy of each state of for each prefix length . For each local epsilon transition or empty shortcut add for every . For each local character transition matching , add . For each nonempty shortcut labeled by the occurrence , add an edge from to . There are vertices and edges. A shortcut for every accepted nonempty occurrence is present. If a shortcut label matches another occurrence of the same string in , the construction also contains the shortcut stored for that occurrence. We can therefore use the shortcut corresponding to the positions currently being read. Replacing child traversals then shows that reaches exactly when .
For every , perform a graph search from , marking its source as reachable. Each reachable with gives the accepted substring . Reachability of detects acceptance of , which is recorded once. These searches take time and use the stated workspace. Repeat for each child and insert the resulting shortcuts in .
4 Preprocessing for State-Set Transitions
We now show how to efficiently preprocess micro TNFAs in the nested decomposition and small substrings together. We construct the shortcut micro TNFAs during preprocessing and tabulate four functions on them, called micro TNFA functions, allowing the simulation to evaluate state-set transitions by table lookup. We show how to tabulate these efficiently and that they suffice to implement state-set transitions in the following subsections.
Let be a nested decomposition with parameter . Let and let be a string of length . For , , and , define
In the last two definitions, ranges over . The set contains lengths of prefixes already consumed, so an extension from length to length matches . In particular, allows an empty extension. The first two functions return local state sets, and the last two return sets of prefix lengths. For fixed state arguments, SuffixStateExtend and SubstringMatchExtend preserve unions in , and StringStateExtend and PrefixMatch preserve unions in . All four functions map the empty set to the empty set.
Intuitively, SuffixStateExtend starts at after any prefix length in has been consumed and returns all states reachable after reading the remaining suffix of . StringStateExtend returns all states reachable from after reading the entire string . PrefixMatch returns the lengths of prefixes of that take some state in to . Finally, SubstringMatchExtend starts at after any prefix length in and returns all prefix lengths at which can be reached by reading the intervening substring. All paths are taken in the shortcut micro TNFA .
4.1 Encoding and Tabulation
We now show how to encode and tabulate the micro TNFA functions efficiently. More precisely, we will represent each function as a lookup table indexed by its argument and store the output in the corresponding entry. We encode a local state set (parameter ) as a bitstring of at most bits, and a set of indexes (parameter ) as a bitstring of length . We encode each local state (parameters and ) as -bit integers. Similarly, we encode state set output for SuffixStateExtend and StringStateExtend as a bitstring of at most bits, and the set of indexes output for PrefixMatch and SubstringMatchExtend as bitstrings of length . We obtain the following tabulation.
Lemma 3 Let be the nested decomposition from Lemma 1 for a regular expression of length , with parameter , and let be a constant alphabet of size . Using the above encoding, we can tabulate the four micro TNFA functions for every , every , and all choices of local state arguments in
time and words of space. Each evaluation takes time, provided the encoded inputs and outputs fit in machine words and the tables are addressable.
Proof. Fix and let and . For each choice of state arguments, store a separate table indexed by the set argument. The numbers of entries for SuffixStateExtend, StringStateExtend, PrefixMatch, and SubstringMatchExtend are, respectively,
Their sum is , and each entry occupies words. The encoded state arguments select the appropriate table, and the encoded set argument selects its entry.
To construct the tables, build the layered graph from Lemma 2 for and perform a graph search from every , where and . These searches provide all singleton images: from record reachable states at length and, for each , the lengths at which is reachable. The searches and recording take time. For each fixed choice of state arguments, fill the table by preservation of unions: set and use
for any set bit of a nonzero input bitmap . Enumerating bitmaps by their highest set bit gives constant work per entry without requiring a bit-search instruction.
For each , construct the shortcut micro TNFAs bottom-up using Lemma 2. The construction, searches, and temporary storage per micro TNFA are polynomial in and are absorbed by : for and , every fixed-degree polynomial in is . By Lemma 1, there are micro TNFAs. Summing over these micro TNFAs and strings, and allowing time and space for the decomposition, proves the bounds.
5 Computing State-Set Transitions
We now show how to efficiently implement state-set transitions using the preprocessing from the previous section. The algorithm proceeds in the following three phases. The first two phases traverse the nested decomposition to compute auxiliary information, which we then use in the final phase to perform the state-set transition.
5.1 Phase 1: Computing Path Prefixes in to
Let be the global state set immediately before reading . For every define
Intuitively, records how many characters of can be read before reaching the accepting state of , starting from an active state inside and staying within .
We compute in a bottom-up traversal of using the micro TNFA functions as follows.
Intuitively, the first term accounts for paths starting at an active local state of and reaching . Each term in the union accounts for paths starting inside a child : gives the prefix lengths at which they can reach , and extends these paths from to inside . We formally prove (2) in Lemma 4.
5.2 Phase 2: Computing Path Prefixes in to
We next compute the prefix lengths at which the start state of is reachable from in the full TNFA .
Intuitively, records how many characters of can be read before reaching the start state of , starting from any active state in the full TNFA . For the root of , its start state is the start state of ; under the usual Thompson construction this state has no incoming transitions. Thus if , and otherwise.
Let be a child of . A path from to can originate in a state local to , enter via , or originate in a child of and first leave that child at . It follows that
Intuitively, the first term accounts for paths starting at an active local state of and reaching . The second term extends paths that have reached , using to specify the consumed prefix lengths. Each term in the final union extends paths that start inside a child and reach its accepting state , using for these prefix lengths. In each case, the extension to stays inside . We formally prove (3) in Lemma 4.
The accepting-state prefix sets of both children of may occur, including the destination child . After completing Phase 1, we compute using (3) in a top-down traversal of the nested decomposition, visiting parents before their children.
5.3 Phase 3: Updating State Sets
Finally, let . The states of reachable after all characters are
Intuitively, the first term accounts for paths starting at an active local state of and reading all of . The second term uses to extend paths from the start state through the remaining suffix. Each term in the final union similarly uses to extend paths from a child's accepting state . In each case, the extension stays inside and returns the local states reachable after all of . We formally prove (4) in Lemma 4. Each computed is the restriction of to , so the copies of shared states agree. These local state sets are used for the next substring.
5.4 Correctness
Lemma 4 Let be a state set of and let . Phase 1 computes as defined in Section 5.1 for every . Phase 2 computes as defined in Section 5.2. Phase 3 computes
Consequently, the three phases implement the state-set transition .
Proof. By the shortcut property (1), a path inside between local states, matching a substring of q, can be replaced by a matching path in , and conversely. We use this property to justify the three recurrences.
For Phase 1, proceed by induction from leaves to the root. Consider a path inside from to matching . If its initial state is local to , the shortcut property places in the first term of (2). Otherwise it starts inside a child . Take its first visit to that child's accepting state , after consuming characters. The initial segment stays inside , so by induction. The remaining segment stays inside and matches , giving the corresponding child term. Conversely, the first term expands to a path of the required kind, and each child term concatenates such an initial path in with a path in . This proves the recurrence, including the leaf case.
For Phase 2, proceed by induction from the root to the leaves. The root initialization is correct because the start state of has no incoming transitions. Let be a child of and consider a path from to matching . If the path is not entirely inside , split it at its last entry into , through its start state by the interface property from Section 3.1. By induction, the consumed prefix length belongs to , and the remaining path gives the second term of (3). If the path stays inside , it either starts locally in , giving the first term, or starts inside a child of . In the latter case split at its first visit to the accepting state of ; Phase 1 supplies the consumed prefix length in , giving a term in the final union. Conversely, each term concatenates a valid prefix path with a path inside ending at . Thus the recurrence computes exactly the required prefix lengths for reaching the start state.
Finally, consider a path from to a local state of matching all of . If it leaves or starts outside , split at its last entry through the start state , using the same interface property. Phase 2 supplies the prefix length, and the remaining suffix gives the second term of (4). Otherwise the path stays inside . It either starts locally, giving the first term, or starts inside a child ; splitting at its first visit to the child's accepting state gives a term in the final union by Phase 1. Conversely, each term expands to a path from to its output state matching . Hence the output is exactly . These local sets cover all states and agree at shared interfaces, so together they represent .
All splits are at states, and may consume zero characters. The argument therefore also includes epsilon paths, empty substrings, and repeated child traversals.
5.5 Encoding and Analysis
We use the encoding of the micro TNFA functions from Section 4. Number the local states of each and encode and as bitstrings of at most bits. Encode and as bitstrings of length , where bit indicates membership of prefix length . The shared states retain their local numbers in each micro TNFA; parent-child pointers store these numbers for the interface states. Each state argument is therefore available as a -bit integer.
For each fixed , the tables from Lemma 3 take the encoded state arguments and set argument and return the encoded output. We evaluate each term of (2)–(4) by one lookup and implement each union by bitwise OR. The prefix-length encodings are the same for all micro TNFAs processing , so a child's prefix mask can be used directly in its parent's tables. The output of Phase 3 uses the same local-state encoding as the input of Phase 1 for the next string. We obtain the following implementation bound.
Lemma 5 Given the tables of Lemma 3, a string of length together with its table index, and the encoded local restrictions of , the three phases compute the encoded local restrictions of in time using space in addition to the tables, provided the encoded inputs and output fit in words and the tables are addressable.
Proof. Each micro TNFA has at most two children. Phase 1 uses at most three lookups per micro TNFA, Phase 2 at most four per parent-child pair, and Phase 3 at most four per micro TNFA. Each lookup and each bitwise union takes time. A bottom-up traversal evaluates Phase 1, a top-down traversal evaluates Phase 2, and one further traversal evaluates Phase 3. By Lemma 1, the decomposition contains micro TNFAs, proving the time bound. For each micro TNFA we store the current and updated local state masks and the two prefix masks, using words. We retain the current state masks until Phase 3 finishes. Correctness follows from Lemma 4, which also ensures that the updated masks agree at shared states.
6 The Full Algorithm
Fix and an integer , and put . If is bounded, the budget condition bounds by a constant depending on , so ordinary TNFA simulation takes time and space. Otherwise, let for a sufficiently small constant depending on , with , and take the threshold for large enough that .
We first handle short texts and small patterns. If , ordinary simulation takes time and space. If , use the entire TNFA as a single micro TNFA, with and . Lemma 3 tabulates its functions in time and space: since , its bound is . Encode the input strings and apply Lemma 5 to this single micro TNFA, taking additional time. Thus this case costs time and space. For the remainder assume , and choose
6.1 Algorithm
Construct and its nested decomposition with parameter , and tabulate the micro TNFA functions for every micro TNFA and every using Lemma 3. Number the alphabet symbols by and index each string's tables by its length and base- value. For each micro TNFA, a directory indexed by these two values selects the corresponding tables.
Initialize and its local restrictions. Partition into consecutive strings of length , except possibly the shorter final string. For each string , compute its table index and apply the three phases of Section 5.1–5.3 to update the local restrictions of . Accept if and only if after all strings have been processed. For empty input, apply this test immediately after initialization. By Lemma 4, each iteration computes , so the final test decides whether .
6.2 Analysis
For these parameters,
Since and and for sufficiently large , Lemma 3 gives preprocessing time and space. The directories use words and are included in this bound. Choosing smaller if necessary ensures that the string encodings, masks, and table indices fit in machine words and that the tables are addressable under .
Constructing and initializing the local state representation takes time. Encoding each nonempty input string takes time, for time in total. Since and , there are strings, and Lemma 5 processes each in time. Thus the total matching time is
Apart from the tables, the nested decomposition, local state numbering, parent-child pointers, and current and updated masks use words. Shortcut micro TNFAs are temporary preprocessing data. Thus the total space is .
For fixed and , in the nontrivial range. Combining these bounds with the cases handled above and using , we obtain
time and space. We have therefore shown the following theorem.
Theorem 2 Let be a regular expression of length over a constant-size alphabet , and let be a string of length . For any fixed and any integer , we can solve regular expression matching in
time and space.
References
[1] Amir Abboud and Karl Bringmann. Tighter connections between formula-sat and shaving logs. In Proc. 45th ICALP, 2018.
[2] Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman. Compilers: principles, techniques, and tools. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1986.
[3] Arturs Backurs and Piotr Indyk. Which regular expression patterns are hard to match? In Proc. 57th FOCS, pages 457–466, 2016.
[4] Philip Bille. New algorithms for regular expression matching. In Proc. 33rd ICALP, pages 643–654, 2006.
[5] Philip Bille and Martin Farach-Colton. Fast and compact regular expression matching. Theoret. Comput. Sci., 409:486 – 496, 2008.
[6] Philip Bille and Mikkel Thorup. Faster regular expression matching. In Proc. 36th ICALP, pages 171–182, 2009.
[7] Philip Bille and Mikkel Thorup. Regular expression matching with multi-strings and intervals. In Proc. 21st SODA, 2010.
[8] Karl Bringmann, Allan Grønlund, and Kasper Green Larsen. A dichotomy for regular expression membership testing. In Proc. 58th FOCS, pages 307–318, 2017.
[9] Greg N. Frederickson. Ambivalent data structures for dynamic 2-edge-connectivity and k smallest spanning trees. SIAM J. Comput., 26(2):484–538, 1997. Announced at FOCS'91.
[10] Z. Galil. Open problems in stringology. In A. Apostolico and Z. Galil, editors, Combinatorial problems on words, NATO ASI Series, Vol. F12, pages 1–8, 1985.
[11] Minos N Garofalakis, Rajeev Rastogi, and Kyuseok Shim. SPIRIT: Sequential pattern mining with regular expression constraints. In Proc. 25th VLDB, pages 223–234, 1999.
[12] Victor M. Glushkov. The abstract theory of automata. Russian Math. Surveys, 16(5):1–53, 1961.
[13] Theodore Johnson, S. Muthukrishnan, and Irina Rozenbaum. Monitoring regular expressions on out-of-order streams. In Proc. 23nd ICDE, pages 1315–1319, 2007.
[14] Kenrick Kin, Björn Hartmann, Tony DeRose, and Maneesh Agrawala. Proton: multitouch gestures as regular expressions. In Proc. SIGCHI, pages 2885–2894, 2012.
[15] S. C. Kleene. Representation of events in nerve nets and finite automata. In C. E. Shannon and J. McCarthy, editors, Automata Studies, Ann. Math. Stud. No. 34, pages 3–41. Princeton U. Press, 1956.
[16] Sailesh Kumar, Sarang Dharmapurikar, Fang Yu, Patrick Crowley, and Jonathan Turner. Algorithms to accelerate multiple regular expressions matching for deep packet inspection. In Proc. SIGCOMM, pages 339–350, 2006.
[17] Quanzhong Li and Bongki Moon. Indexing and querying XML data for regular path expressions. In Proc. 27th VLDB, pages 361–370, 2001.
[18] R. McNaughton and H. Yamada. Regular expressions and state graphs for automata. IRE Trans. on Electronic Computers, 9(1):39–47, 1960.
[19] Makoto Murata. Extended path expressions of XML. In Proc. 20th PODS, pages 126–137, 2001.
[20] E. W. Myers. A four-russian algorithm for regular expression pattern matching. J. ACM, 39(2):430–448, 1992.
[21] Gonzalo Navarro and Mathieu Raffinot. Fast and simple character classes and bounded gaps pattern matching, with applications to protein searching. J. Comput. Bio., 10(6):903–923, 2003.
[22] K. Thompson. Regular expression search algorithm. Commun. ACM, 11:419–422, 1968.
[23] Larry Wall. The Perl Programming Language. Prentice Hall Software Series, 1994.
[24] Fang Yu, Zhifeng Chen, Yanlei Diao, T. V. Lakshman, and Randy H. Katz. Fast and memory-efficient regular expression matching for deep packet inspection. In Proc. ANCS, pages 93–102, 2006.