Thompson's algorithm for regular expression matching

E162093

Thompson's algorithm for regular expression matching is a classic method that converts regular expressions into nondeterministic finite automata (NFAs) to enable efficient pattern matching in text processing.

All labels observed (4)

How this entity was disambiguated

Statements (48)

Predicate Object
instanceOf NFA construction algorithm
algorithm
regular expression matching algorithm
advantage avoids exponential blowup of DFA construction in many cases
linear-time NFA construction in the size of the regular expression
simple and systematic construction rules
alsoKnownAs Thompson's algorithm for regular expression matching
surface form: Thompson construction for NFAs

Thompson's algorithm for regular expression matching
surface form: Thompson's construction
basedOn regular expressions
constructionRule for Kleene star, add epsilon transitions to allow zero or more repetitions of the operand NFA
for a literal symbol, create an NFA with one transition labeled by that symbol
for alternation, create new start and accept states with epsilon transitions to and from the operand NFAs
for concatenation, connect accept state of first NFA to start state of second NFA with epsilon
contrastWith backtracking-based regex matching algorithms
coreIdea construct an NFA whose size is linear in the length of the regular expression
simulate the constructed NFA to perform matching
creator Ken Thompson
field automata theory
computer science
formal language theory
text processing
input regular expression
output NFA
produces nondeterministic finite automata
property construction is compositional over the structure of the regular expression
constructs NFAs with a single start state and a single accept state
does not suffer from catastrophic backtracking
matching time is guaranteed polynomial in input size
publishedIn Communications of the ACM
purpose implementation of regular expression engines
pattern matching in strings
relatedTo Glushkov construction
backtracking regular expression engines
deterministic finite automata
position automaton
powerset construction
simulationMethod epsilon-closure computation of NFA states
subset simulation of active NFA states
spaceComplexity O(m) for NFA simulation
timeComplexity O(n·m) for matching, where n is input length and m is NFA size
usedIn Unix text processing tools
early Unix regular expression implementations
many NFA-based regex engines
usesOperation Kleene star
alternation
concatenation
epsilon transitions
yearIntroduced 1968

How these facts were elicited

Referenced by (4)

Full triples — surface form annotated when it differs from this entity's canonical label.

Ken Thompson knownFor Thompson's algorithm for regular expression matching
Thompson's algorithm for regular expression matching alsoKnownAs Thompson's algorithm for regular expression matching
this entity surface form: Thompson's construction
Thompson's algorithm for regular expression matching alsoKnownAs Thompson's algorithm for regular expression matching
this entity surface form: Thompson construction for NFAs
Regular Expression Search Algorithm notableImplementation Thompson's algorithm for regular expression matching
this entity surface form: Thompson NFA construction