tutorpackSee prices
All courses

Programming · course 16 of 105

The Regex Field Guide

Go from special characters, classes and repeats to anchors, greedy vs lazy matching and what Python’s findall, sub and split give back, then write patterns that match exactly.

4 modules

Not on sale yet. When sales open: $4.99 for this course, paid once, or every course for $9.99 a month. Prices

Preview

What it teaches

The regular-expression basics, checked in Python: the special characters, classes like [a-z] and \d, repeats (* + ? {m,n}), anchors (^ $ \b), alternation with | and brackets, greedy vs lazy matching, and what findall, sub and split give back. You say which strings a pattern matches, predict what a call returns, and write patterns that match exactly what’s asked. The AI asks 3 questions, places you, shows a short card per module, then gives you one item at a time and checks you against an answer key: every answer about what a pattern matches or returns came from running it in Python.

Answers use Python’s re. Tested on JavaScript (Node 25): the patterns here give the same matches on this course’s strings, with four differences: fullmatch needs ^ and $ in JavaScript, findall with groups returns whole matches there, $ matches just before a final newline only in Python, and the letter class matches accented letters only in Python. Java, editors, spreadsheets and grep were not tested.

How long

34 items. About 40-50 rounds from scratch (about 15 if you already know the basics) plus a 12-item final: 2-3 sessions (estimate, not timed with a real student). The tutor gives a one-line save code at the end of each session.

The modules

4 modules, drilled one item at a time.

  1. M0

    The words

    Concept questions

  2. M1

    Which strings match?

    Say which strings a pattern matches (whole string, or anywhere inside)

  3. M2

    What does it return?

    Say what findall, sub or split returns

  4. M3

    Write the pattern

    Write the pattern

Before it teaches, it asks

  1. 1
    Where do you use (or want to use) regular expressions: code, spreadsheets, a text editor, log searches? Have you written any?
    AI voice (ElevenLabs)
  2. 2
    Which of these strings does the pattern match as a whole (re.fullmatch)?Pattern: ca+tStrings: "cat", "ct", "caaat", "cart"
  3. 3
    What does this return?re.findall(r"<.*>", "<b>hi</b>")

What’s exact, and what isn’t

Show

Straight from the course’s own notes.

Produced by running the patterns
Every pattern was run on Python 3.14.3 and 3.9.6 (they agree). Every answer to a which-strings-match or what-does-it-return question is what Python returned; listed wrong answers with a slip were produced by running the slip. Every pattern on the answer list for the write-the-pattern questions passes every test string, and every listed wrong pattern gets at least one wrong; a pattern of your own is checked by the tutor against the same strings, by hand.
Sourced
The Python Regular Expression HOWTO and re module docs, short quotes matched word for word on 2026-10-10.
Not in it yet
Lookarounds, named groups, flags, backreferences.