From character classes and quantifiers to anchors, groups and captures, Python's re and JavaScript's RegExp, lookarounds and backreferences, using regex in grep, ripgrep, sed and editors, and spotting patterns that turn slow. Over 30 lessons you get to where you can pull the shape you want out of logs and input, write it readably, and know when not to use a regex. The examples run as Python and JavaScript right in your browser, and all terminal output comes from real runs.
about 6.5 hours in total (estimate)
The 30 lessons are split into 6 chapters. We recommend going in order from chapter 1,
but feel free to dip into whatever catches your interest.
Note: the Python and JavaScript examples run right in your browser (Python is 3.12's re). The grep, ripgrep, sed and git commands in chapter 5 don't run inside the browser, so try them in your own terminal (macOS, Linux, or WSL). Where the syntax differs from tool to tool, the lesson says so.
Take this chapter's review quiz ›
Learn the idea of searching by shape instead of by fixed text, and build patterns from metacharacters, character classes, and quantifiers. You'll finish by pulling order numbers, postal codes, and phone numbers out of a bakery's intake notes.
Take this chapter's review quiz ›
Learn to use anchors that point at the edges of lines and words, groups that bundle pieces, captures that extract contents, and greedy versus lazy repetition. You'll finish by taking the bakery's application log apart line by line and tallying it.
Take this chapter's review quiz ›
Learn which search function to use when, replacing with sub and functions, split and flags, and writing readable patterns with compile and re.VERBOSE. You'll finish by masking personal data in a log and normalizing its dates before handing it to someone.
Take this chapter's review quiz ›
Learn lookaheads and lookbehinds that check only the surroundings, backreferences that demand the same text again, handling Japanese and full-width characters, and JavaScript's RegExp. You'll finish by building a checker that finds slips in a draft menu.
Take this chapter's review quiz ›
Take the same ideas into grep, ripgrep, sed, editors, and git. You'll see the dialect differences between tools in real output, and finish by investigating an access log both in Python and in the terminal.
Take this chapter's review quiz ›
Learn how a regex engine searches behind the scenes, and how to spot and fix patterns that turn slow. Pick up a sense of proportion for input validation and for when not to use a regex, and finish by pulling it all together in a small log-reading tool.
Once you finish all 30 lessons, broaden your string and file handling in the Python course, chain grep and sed together in the shell scripting course, or validate input in the browser with the JavaScript course. Membership unlocks every course.