Regex
The notation, and the machine under it
Everyone can write a pattern that matches. Far fewer can say what one matched, where it started, or why it took half the line. This is the engine procedure, drilled on questions generated fresh: predict a span, read a capture, spell the one a requirement asks for — then write three against input built to break them.
- Modules
- 6
- Drills
- 9
- Build steps
- 6
- Time
- ~4h
Walk out able to
Read an unfamiliar pattern out loud, predict the exact text it matches, and name the token responsible when the result is wrong.
What this covers
Where a match begins
The scan, the classes, and what a quantifier binds to.
Greedy, lazy, anchored
The retreat that decides a span, and what stops it.
Groups and lookaround
Captures by number, backreferences, lookaround.
Patterns that go wrong
Extract, validate, and repair one that never returns.
The pitch
What you practise, and what you leave with
A field extractor over a log with two malformed lines, a validator against eighteen near-misses, and the repair of a pattern that hangs.
You will practise
- Classes, quantifiers and what they bind to
- Greedy against lazy, to the character
- Anchors, captures, backreferences, lookaround
- Writing one from scratch, repairing a broken one
Afterwards you can
- Predict the exact text a pattern matches
- Anchor a validator on purpose, not by luck
- Read any capture out by number
- Repair a pattern that never returns
Modules
6 modules, 31 items
Lessons explain one idea. Drills repeat it until it sticks. Build steps make something that exists afterwards.
- 1
How the engine reads a pattern
~48 minSay where a match begins and what a class covers, before meeting a quantifier.
- LessonWhy a pattern, and not find4 min
- LessonFind where the match starts8 min
- LessonRead the dot for what it is6 min
- DrillSay what a class matches10 min
- DrillMatch it whole, or not at all11 min
- DrillSay it in the notation9 min
- 2
Greedy, lazy and backtracking
~34 minPredict the exact text a quantifier takes, and say what made it stop there.
- LessonWatch a quantifier give ground10 min
- LessonTurn the run around6 min
- LessonWhat the retreat costs6 min
- DrillPredict the matched text12 min
- 3
Anchors and boundaries
~27 minPin a pattern to a position, and count what it finds without guessing.
- LessonPin the pattern to a position9 min
- LessonThe anchor you did not type6 min
- DrillCount the matches12 min
- 4
Groups, captures, backreferences
~42 minRead any capture out by number, and demand the same text a second time.
- LessonWhat group one actually holds7 min
- LessonThe other two jobs of a bracket7 min
- LessonCaptures on the way out5 min
- DrillRead a capture out12 min
- DrillDemand the same text twice11 min
- 5
Lookaround
~32 minRequire a condition without taking the characters that satisfy it.
- LessonAssert without consuming9 min
- LessonStack conditions on one string6 min
- LessonWhere a pattern is the wrong tool6 min
- DrillSay what was consumed11 min
- 6
Put it to work
~1hRead, write and repair real patterns against input that does not cooperate.
- LessonRead a pattern somebody else wrote7 min
- LessonName the token, then change it6 min
- DrillPick the one-token repair10 min
- Build stepCapture four fields from a log9 min
- Build stepTotal only the successful requests8 min
- Build stepWrite the ticket-code format8 min
- Build stepMake it refuse the near-misses8 min
- Build stepReproduce the hang, and time it7 min
- Build stepRepair the pattern that hangs9 min
More in Tools & workflow
Keep going
Git: The Model
Stop memorising the commands. Learn what they move.
Intermediate~5h6 modules
Git: Collaboration
Two people, one history, and no surprises.
Intermediate~5h7 modules
VS Code
Stop guessing what the window just did.
Foundational~4h6 modules
JSON & YAML
Two formats you can read. Neither one means what you think.
Intermediate~4h5 modules
Read the pattern. Then predict exactly what it does.
The first item is free. ~4h of focused work, at your own pace.
Intermediate~4h6 modules