Regular expression

Also known as: Regex, Regexp

A regular expression is a compact notation for a regular language over an alphabet $\Sigma$: symbols, concatenation, union (| / $+$), and Kleene star (*), plus parentheses.

In theory, $L(r)$ is the language denoted by regex $r$. In code, engines add sugar (character classes, +, ?, backreferences). Pure regular expressions (no backrefs) match exactly what finite automata can accept.

The constructive bridge is Thompson construction: regex → ε-NFA → NFA → optional DFA. That is why “regex = finite state machine” is not a metaphor; it is an algorithm.

← Back to CS Glossary