Regex practice
Read what to match, then write the pattern. Any regex that passes the checks counts, not just the one in the answer.
46 patterns in 8 lessons. Your progress is kept in this browser.
Getting started
- Just learned
- Recalling
- Steady
- Quick
- Fluent
- Second nature
- Learned
- 0
- Due now
- 0
- New
- 0
- Streak
- 0
Lessons
- 1Characters and classes
- 2Quantifiers
- 3Anchors and boundaries
- 4Groups and alternation
cat|dog(ha)+(?:https://)?example\.com(?<year>\d{4})\b(\w+) \1\b - 5Lookarounds
- 6Flags
- 7Escaping
- 8Common patterns
-?\d+\d+(\.\d+)?#[0-9a-fA-F]{6}\d{4}-\d{2}-\d{2}\S+@\S+\.\S+^\s+|\s+$/^\s*$/m\b(red|green|blue)\b
How practice works
Each question describes what to match, and you write the pattern. Your answer is run against example strings, so any regex that matches the right text and nothing else is accepted. Write flags as /pattern/flags.
- Learn shows each new pattern with its answer to type once, then asks for it again without help, and schedules the next review.
- Practice goes through a lesson at your own pace. Press Esc to see the answer. It does not change your reviews.
- Speed run asks every item once, without answers, against the clock. Get 70% right first time to pass.
- Today's session brings back what is due for review plus a few new ones.
A wrong answer tells you what was off, such as the text a pattern missed. After two tries the answer is shown, and you type it to move on. Progress is stored in this browser only; the daily goal and streak are shared with the keyboard shortcut practice.
To look something up instead, use the regex syntax list.