
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Explore curly brace quantifiers in regular expressions to control repetitions, using {m,n}, {n}, and {m,} for exact or range matches, illustrated with kittens and dot patterns.
Explore how to use regular expressions to match variations of 'kitten' and control capitalization and punctuation, including one or three periods. Many patterns will be covered to satisfy curiosity.
Anchor at the start of the string to match one or more spaces, with or without dot star, and decide how replacement affects the rest of the line.
Explore character classes in regular expressions, including the dot wildcard and the whitespace class. Learn to anchor patterns with ^ and use \S for non-whitespace.
Explore how word boundary characters in regex function as anchors that do not consume characters, signaling where a match occurs and illustrating differences from non word boundary tokens.
Master regular expressions by exploring anchoring, non-newline patterns, and flag behavior from no flags to multi-line and global in JavaScript.
Explore greedy quantifiers in JavaScript, where the star quantifier matches as many characters as possible without anchoring, with examples like green and grep, and prepare for lazy quantifier syntax.
Explore multi-character strings by building groups with collections and a one-or-more quantifier for non-overlapping matches, using W, zero, or capital O, and preview the next, more complex regex.
Craft a regular expression to validate 24-hour times, matching hours 0–23 and minutes 00–59, with proper anchoring and multi-character hour options.
Regular expressions have a bad reputation for being difficult to understand. This course introduces tools and a systematic approach so you can unlock the power of regular expressions to write compact, elegant code.
Course Concepts
In this course, we will cover concepts from basic to advanced:
Quantifiers
Character collections, including negation
Character ranges
String boundaries
Character Classes
Flags
Greedy vs. Lazy Quantifiers
Multi-Character Quantifiers and Options
Capturing Groups (numbered and named)
Substitution / Replace
Lookahead and Lookbehind
Depending on your level of experience, you can start at the beginning, or start later with concepts you've always been interested in, but haven't had a chance to learn yet.
Course Examples
Examples progress in a logical, narrative way. At the end of one example, we will think about how we might tweak it to do something similar but more powerful. In this way, the concepts flow naturally from one example to the next.
The course has 44 examples in the course of the lectures, each written out on different platforms (JavaScript / Python / Linux (grep)) in the course repository. Each regular expression is fully commented and has test cases to show how it's intended to be used, so these are a great starting point if you like to "code by example" -- start with an example you know works and tweak it for your purposes.
Course Exercises
There are also 46 exercises using Udemy's code challenge platform. You are given a description of a regular expression, and then you write it using your choice of JavaScript or Python syntax. After you're done, tests written especially for the exercises will let you know whether your regular expressions did the job they were supposed to. These exercises are a great way to cement the concepts in your brain, and make sure you really understand the material presented in the lectures.
Course Tools
The course uses regex101 (with permission of the author) to show how regular expressions match the test strings. There are also slides breaking down each regular expression example and explaining each piece.
Questions encouraged!
Please use the Q&A feature on Udemy to ask questions! I love to talk about why regular expressions don't seem to be working, discussing decisions I made about course content, and debating regular expression philosophy.