01

Expression Builder

Compose a regular expression using the symbol palette below, then inspect its NFA/DFA structure and properties in real time.

Literals
Operators
Snippets
Enter a regular expression above to see its analysis.
02

String Generator

Enumerate all strings accepted by a regular expression up to any length, in BFS order.

10
100
Enter a regular expression and click Generate.
03

String Tester

Test whether individual strings or batches of strings are accepted or rejected by a regular expression.

Batch results will appear here.
04

Equivalence Checker

Two REs are equivalent iff they define the same language. Uses Thompson's NFA β†’ Subset DFA β†’ BFS product automaton.

≑?
Enter two regular expressions and click Check Equivalence.
05

Reference Guide

Notation, operator table, algebraic laws, and the algorithm pipeline used by this tool.

Notation

NotationMeaningExampleAccepts
aLiteral symbolaa
Ξ΅Empty stringΞ΅""
βˆ…Empty setβˆ…nothing
r+sUniona+ba or b
rsConcatenationabab
r*Kleene stara*Ξ΅, a, aa, ...
r!One or morea!a, aa, aaa, ...
r?Zero or onea?Ξ΅ or a
(r)Grouping(ab)*Ξ΅, ab, abab, ...

Algebraic Laws

LawIdentity
Annihilationrβˆ… = βˆ…r = βˆ…
Identity (concat)rΞ΅ = Ξ΅r = r
Identity (union)r+βˆ… = r
Commutativityr+s = s+r
Associativity(r+s)+t = r+(s+t)
Idempotencyr+r = r
Distributivityr(s+t) = rs+rt
Star idempotent(r*)* = r*
Star of emptyβˆ…* = Ξ΅
Star of ΡΡ* = Ρ
Plus definitionr! = rr*
Question definitionr? = r+Ξ΅
Arden's LemmaL = rL+s β‡’ L = r*s

Algorithm Pipeline

01
Parsing
Recursive-descent parser builds an abstract parse tree respecting precedence: grouping > repetition > concatenation > union.
↓
02
Thompson's NFA Construction
Each sub-expression maps to an NFA fragment with exactly one start and one accept state. Fragments are composed via union, concatenation, and star constructions using Ξ΅-transitions.
↓
03
Ξ΅-closure & Subset Construction
Each DFA state is a set of NFA states reachable via Ξ΅-transitions. BFS over subsets builds the complete DFA. A DFA state is accepting iff any NFA state in it is accepting.
↓
04
Equivalence via Product Automaton
BFS over pairs (q₁, qβ‚‚) of DFA states from both machines. If any pair has one accepting and one rejecting, the witness input string distinguishes the two languages.

Complexity

OperationComplexity
ParsingO(n)
Thompson's NFAO(n) states, O(n) transitions
Subset DFAO(2ⁿ) states worst case
NFA simulationO(nΒ·|w|)
Equivalence checkO(|DFA₁| Γ— |DFAβ‚‚|)