Skip to content

Learn

Nine tracks, in the order they build on each other. Every claim in a lesson is a pattern you can run against the same engine that grades you, right beside the sentence that makes it.

Literals and classes

Which characters does this actually match?

Escaping, ranges, negation, and the shorthand classes — including what \w really is, which is not what the name suggests and is the reason half the email validators in the world reject a real address.

3 lessons · 3 tasks

Quantifiers and greed

How much does it take, and what does it hand back?

*, +, ? and {n,m}, greedy against lazy, and the give-back watched one step at a time. Lazy does not mean efficient, and the step meter is where that stops being an opinion.

2 lessons · 3 tasks

Anchors and boundaries

Where is the pattern allowed to start?

^ and $, what m does to them, \b and its definition — and why a validator without anchors validates nothing at all.

2 lessons · 2 tasks

Groups, captures and backreferences

What did you actually get back?

Numbering, named groups, non-capturing groups, and the two answers a group can give that look the same and are not: it matched nothing, or it never ran.

2 lessons · 4 tasks

Alternation and order

Why did it pick that branch?

Leftmost, not longest. Reordering two branches is a correctness change, and the trace of an alternation that never reaches its second branch is the clearest way to see why.

2 lessons · 2 tasks

Lookaround

How do you test without consuming?

Lookahead and lookbehind as zero-width assertions, and the password-rule pattern rebuilt honestly.

2 lessons · 3 tasks

Catastrophic backtracking

Why has it not come back?

Nested quantifiers, overlapping alternation, the two engines side by side, and rewriting to something linear — or deciding to stop using a regular expression.

2 lessons · 3 tasks

Unicode and flags

What is a character, exactly?

u and code points, case folding, s and y, and what changes when you move the pattern to another flavour.

3 lessons · 3 tasks

Reading a generated regex

What will this match that you did not intend?

The track the rest exists for. You are handed a pattern an agent produced for a stated purpose, with no test inputs. Say what it matches, find the false positive, find the input that hangs it.

Open it

18 lessons built so far.