Regular Expressions practice
32 exercises and 36 quizzes from the lessons of this track. Sample tests run in your browser; what you pass is kept in this browser only.
Foundations: what a regex is and how matching works
Characters, escapes and character classes
- Write a three-part version string pattern that holds together
- Quiz: Literals, metacharacters and the dot
- Highlight every occurrence of a search term
- Quiz: Writing patterns in code: strings and escaping
- Four character classes in two flavours
- Quiz: Character classes, ranges and negation
- A tokenizer for English, Hindi and Tamil text
- Quiz: Shorthand classes for digits, words and spaces
Anchors and boundaries
Quantifiers: greedy, lazy and possessive
Groups, alternation and backreferences
- Parse key=value pairs with groups
- Quiz: Capturing and non-capturing groups
- Quiz: Named groups across regex flavours
- A pattern that returns the longest city name
- Quiz: Alternation and the order of choices
- Repeated words and dates whose month equals the day
- Quiz: Backreferences: matching the same text again
Lookaround and advanced constructs
Flags, modes and Unicode
Flavours compared and regex in each language
- Port five Go patterns to your language
- Quiz: Flavours compared: porting a pattern safely
- A lexer for a small query language
- Quiz: JavaScript regex techniques for text jobs
- Parse a statement of transaction messages
- Quiz: Python regex techniques and the regex module
- Field validators that explain a bad pattern
- Quiz: Regex in PCRE2, PHP and Perl
- Log filters whose patterns also compile in Go
- Quiz: Regex in Go, RE2 and re2js
- Repair two ported patterns
- Quiz: Regex in Java, .NET, Ruby and Rust
Regex in tools, spreadsheets, web standards and data cleaning
- Four shell one-liners, rewritten in code
- Quiz: grep, sed and awk: regex on the command line
- Five filters RE2 compiles and GA4 would apply
- Quiz: Regex in spreadsheets, SQL and analytics tools
- Pattern attributes for four fields, then the schema patterns for them
- Quiz: Regex in HTML, JSON Schema and config files
Validation patterns and their limits
Performance, ReDoS and security
- Build an NFA matcher that reads the text once
- Quiz: Backtracking engines versus automata engines
- Flag nested and overlapping repeated groups
- Quiz: Catastrophic backtracking and ReDoS
- Speed up four patterns of a log reader
- Quiz: Writing fast regexes and measuring them
- A log search that accepts user input safely
- Quiz: Regex with untrusted patterns and input
- Three patterns to review, fix and test
- Quiz: Reviewing regexes from forums or AI assistants
Results here are what this browser has checked: feedback for you, not proof. They stay on this device; your Learn progress can be exported to a file. · Back to the Regular Expressions track