INTRODUCTION
What is regex
A small pattern language for finding and reshaping text. Learn it once, use it everywhere.
A regular expression - regex - is a tiny pattern that describes the shape of text you are looking for. Instead of writing a loop that walks the string character by character, you write one pattern and the engine finds every piece that fits. One pattern replaces a page of string-handling code.
Say you want every number in a line. The pattern is \d+: a digit, one or more times. The same pattern works in your editor, in grep, in a database, and in code:
The pattern is identical. Only the surrounding API differs - slashes and a g flag here, re.findall there. The skill is portable: the same patterns run in editors, databases, sed, grep, ripgrep, Python, JavaScript, Go, and Ruby.
It pays off in daily work: search-and-replace across a whole codebase, pulling emails, dates, and IDs out of logs, validating input, bulk-renaming files, and filtering output with grep or ripgrep. Learn it once and it follows you to every tool.
This course is hands-on. Each lesson is short, then you write a pattern until the tests turn green. Progress is saved in your browser - no signup, nothing to install. Start below.
These drills always match globally: every occurrence is highlighted, not just the first.
Match every run of digits in the line. "4821" counts as one match, not four.
Order 4821, call 555 0100
room 12 floor 3
no numbers here
a1b22c333