Learn Regex
28 lessons, from "what is regex" to interview questions and challenges. Progress is saved locally in your browser.
Your progress
0 / 28 lessons · 0%
1What is RegexA gentle introduction to regular expressions — what they are, why they exist, and where you'll use them every day.2Regex EnginesWhat actually runs your pattern — backtracking engines like JavaScript and Python vs. finite-automaton engines like RE2 — and why the difference matters.3LiteralsMatching exact text: case sensitivity, the i flag, and which characters are metacharacters that need escaping.4Character ClassesMatching one of several characters at a position using [...], negation with [^...], ranges, and the \d \w \s shorthand classes.5AnchorsMatching positions instead of characters: ^ and $ for start/end of string, \b and \B for word boundaries, and how the m flag changes things.6QuantifiersControlling how many times a piece of a pattern repeats: *, +, ?, {n}, {n,}, and {n,m}.7GroupsUsing parentheses to treat a sequence of characters as a single unit you can quantify — plus a preview of capturing, non-capturing, and named groups.8Capturing GroupsLearn how parentheses capture the text a regex matches, so you can reuse it with backreferences, pull it out in JavaScript with match() or exec(), or rearrange it in a replacement string.9Non-Capturing GroupsUse (?:...) to group parts of a pattern for structure or quantifying without adding a numbered capture group you'll never use.10Named GroupsGive capturing groups readable names with (?<name>...) and access them through match.groups, turning cryptic numbered captures into self-documenting patterns.11AlternationUse | to match one of several alternatives, and learn the operator-precedence gotchas that make ^cat|dog$ behave very differently from ^(?:cat|dog)$.12LookaheadUse positive lookahead (?=...) to check what comes next in a string without consuming it — the trick behind requiring several conditions at once, like password strength rules.13Negative LookaheadUse (?!...) to assert that something does NOT come next, without consuming characters — the standard tool for matching a word not followed by X or filtering unwanted matches out of a result.14LookbehindMatch a pattern only when it is preceded by something specific, without including that something in the match, using positive lookbehind.15Negative LookbehindMatch a pattern only when it is NOT preceded by something specific, using negative lookbehind (?<!...).16Greedy MatchingUnderstand why quantifiers like *, +, and {n,} are greedy by default — matching as much text as possible before backtracking.17Lazy MatchingLearn the lazy (non-greedy) quantifiers *?, +?, ??, and {n,m}? which match as little text as possible instead of as much.18Regex FlagsA complete tour of JavaScript regex flags — g, i, m, s, u, y, d, and v — and how to combine them.19UnicodeMatch letters, scripts, and emoji correctly across languages using the u flag and \p{...} Unicode property escapes.20EscapingWhich characters have special meaning in regex, why they need a backslash to match literally, and how to handle real symbols like dots, dollar signs, and slashes.21Practical ExamplesFour complete, real-world regex patterns worked end to end — extracting hashtags, validating slugs, parsing query strings, and redacting card numbers.22PerformanceCatastrophic backtracking, why nested quantifiers over overlapping character sets are dangerous, and practical habits for keeping regex fast.23Best PracticesPractical habits for writing regex you and your teammates can actually maintain — readability, testing, named groups, anchoring, and safely handling user input.24Regex Cheat SheetA compact, categorized recap of the anchors, character classes, quantifiers, groups, lookaround, and flags covered throughout this course.25Interview QuestionsSix regex questions that come up again and again in technical interviews, with worked answers and live patterns you can test.26Regex ChallengesHow the graded Challenges section works, and a worked example to show what solving one actually feels like.27ExercisesFive standalone practice exercises, increasing in difficulty, pulling together character classes, anchors, groups, and lookaround.28Regex QuizA short recap of the whole course, congratulations for finishing, and a pointer to the full scored course quiz.