Interactive course
Regex Course
Learn regular expressions from scratch, in English, with an engine that runs every pattern directly in the browser and shows you matches in real time.
01 · Basics
The foundations of regex: literal patterns, basic character classes, the `.` wildcard and escaping meta-characters.
- 1.1Literal patternsNormal characters, case sensitivity and a first run: match and index.~15 min
- 1.2Basic classes: \d \w \sThe predefined classes for digits, word characters and whitespace (and their negated versions).~16 min
- 1.3The wildcard: the dot `.`The `.` character matches almost everything: what it includes, what it excludes, and why the `s` flag matters.~15 min
- 1.4Escaping meta-charactersThe 12 meta-characters that need escaping with `\`, when you need a double backslash and why.~16 min
02 · Quantifiers
How much to repeat: `*`, `+`, `?`, intervals `{n,m}` and the difference between greedy and lazy.
- 2.1`*`, `+`, `?`Zero or more, one or more, optional: the three basic quantifiers.~16 min
- 2.2Exact quantities `{n,m}`Exactly `n`, from `n` to `m`, at least `n`: the numeric quantifier.~16 min
- 2.3Greedy vs lazyBy default quantifiers are greedy (`.*`); add `?` for the lazy version (`.*?`).~16 min
- 2.4Backtracking: an overviewWhat the engine does when a greedy quantifier fails, and why it can be expensive.~18 min
03 · Anchors and boundaries
Position, not characters: anchoring to the start/end of the string, to word boundaries, and to the start/end of each line with the `m` flag.
- 3.1Start and end: `^` and `$`Anchoring a pattern to the first or last character of the string.~15 min
- 3.2Word boundaries: `\b` `\B`The transition between word and non-word characters; finding whole words.~16 min
- 3.3The `m` flag: multilineWith the `m` flag, `^` and `$` anchor to the start/end of each line.~16 min
- 3.4Empty lines and trimUseful patterns: matching empty lines, trimming whitespace at the start/end of a line.~16 min
04 · Groups and alternation
Group with `()`, choose among alternatives with `|`, avoid capturing with `(?:...)`, name groups with `(?<name>...)` and refer back to a previous capture with back-references.
- 4.1Capture groups: `(...)`Parentheses to group and capture; access groups 1, 2, 3… in matches.~16 min
- 4.2Alternation: `|`The pipe chooses between two or more sub-patterns; precedence and parentheses.~16 min
- 4.3Non-capturing groups: `(?:...)`Group without creating a capture: useful when you only need to quantify or alternate.~16 min
- 4.4Named groups and back-references`(?<name>...)` to give a name; `\1` `\k<name>` to refer back to the capture.~18 min
05 · Character classes
Define custom sets with `[...]`, use ranges, negate with `[^...]` and reach Unicode properties with `\p{...}` and the `u` flag.
- 5.1Character sets: `[abc]`Square brackets define a set of characters allowed in one position.~15 min
- 5.2Ranges inside classes: `[a-z0-9]`Intervals via the dash; combining ranges and single characters.~15 min
- 5.3Negation: `[^...]`A negated class matches anything except the listed characters.~15 min
- 5.4Unicode property escapes`\p{L}`, `\p{N}`, `\p{Script=...}` with the `u` flag: semantic Unicode classes.~18 min
06 · Lookaround
Zero-width assertions: look forward or backward in the string without consuming characters. Lookahead `(?=)` `(?!)`, lookbehind `(?<=)` `(?<!)`.
- 6.1Positive lookahead: `(?=...)`Check that a certain pattern follows the current position, without consuming it.~16 min
- 6.2Negative lookahead: `(?!...)`Check that a certain pattern does NOT follow the current position.~16 min
- 6.3Lookbehind: `(?<=...)` `(?<!...)`The "look-backward" versions of lookaround; ES2018+ support.~18 min
- 6.4Lookaround in practiceExtract a value without including the context, validate passwords, parse delimited numbers.~18 min
07 · Flags, substitution, split
All flags (incl. `d`, `v`), `String.prototype.replace`/`replaceAll`/`split` with regex, references `$1`/`$<name>` in the substitution string and replace callbacks.
- 7.1All flags in detail`g i m s u v y d`: what each one does and how they combine.~18 min
- 7.2Basic replace and `$1`Replace matches with a fixed string or with back-references `$1` / `$<name>`.~16 min
- 7.3Replace with a callbackSubstitution function: transform every match with arbitrary JS code, access to groups.~18 min
- 7.4Split with regexSplit a string on a pattern (permissive CSV, minimal tokenizer).~16 min
08 · Practice
Put it all together on real problems: validate emails, parse logs, extract URLs/IPs, write ReDoS-resistant patterns.
- 8.1Validating an emailA "good enough" pattern for emails, with the trade-offs explained.~18 min
- 8.2Apache log parserExtract IP, method, path and status code from a log line using named groups.~18 min
- 8.3Extracting URLs and IPsRecognize http(s) URLs and IPv4 addresses in free-form text.~18 min
- 8.4Writing ReDoS-safe patternsRecognize catastrophic patterns (`(a+)+b`), refactor them, use atomic-like quantifiers.~20 min
Paths featuring Regex Course
Recommended next courses
Regex Course FAQ
How many lessons and hands-on exercises are in Regex Course?
Regex Course covers 8 modules, 32 interactive lessons, and 160 practical exercises (~9 hours total) with instant automated validation.
Do I need local setup or IDE installation for Regex Course?
No installation required: every exercise and the interactive Regex Course playground execute right in your browser via WASM and isolated sandboxes, with instant feedback.
Is Module 1 of Regex Course free without creating an account?
Yes. Module 1 (“Module 1 — Basics”), the live playground, and the printable cheatsheet are permanently free without signup, saving your progress locally in your browser.
Which career learning paths include Regex Course?
Regex Course is a core building block of Data, SQL & Analytics, targeting roles such as Data Analyst · Analytics Engineer · BI Developer.