regex.liter8.sh
Say what it matches before you run it.
A real backtracking regular expression engine, running in your browser, with every step it takes on screen. You write a pattern, or you are handed one — and what you are graded on is the match set, the captures, and the number of steps it took to get there.
Why this one
Regex is the smallest language everyone uses and nobody learns. It is acquired by pasting, adjusted by trial, and abandoned the moment it stops failing on the three inputs at hand.
The real argument is narrower. Models write regular expressions all day, and a regular expression is a program whose behaviour you cannot see. A generated validator or log parser arrives as one line, looks plausible, passes the example it was asked about, and carries one of two defects: it matches something it should not, or on the right input it never finishes. The second is a production outage from one line of code.
A person who can read a pattern and say what it matches — and roughly what it will cost — is the entire mitigation. That is what this is for.
A real engine
A parser, a compiler and a backtracking VM with an explicit stack. It never calls the browser’s own regex engine — not once — because an engine that delegated would be reporting a step count for work it did not do.
Steps, counted
Every instruction and every backtrack is one step. That is how a pattern that is right and ruinous gets told apart from one that is right, and why “this looks slow” becomes a number.
Checked against the reference
Every fixture is recorded from V8’s own RegExp and replayed through this engine. If the two disagree, this engine is wrong.
9 of 9 tracks built · 18 lessons · 23 tasks · your progress