Interactive Pattern Matching Learning Tool

Interactive Pattern Matching Learning Tool

Learn regex pattern matching through practice. Click on a level to start, then test your regular expressions against the provided test strings.

Quick Reference

Pattern Description Example
. Matches any single character h.t matches "hat", "hot", "hit"
^ Matches start of a string ^a matches "apple" but not "banana"
$ Matches end of a string a$ matches "formula" but not "apple"
* Matches 0 or more occurrences ab*c matches "ac", "abc", "abbc"
+ Matches 1 or more occurrences ab+c matches "abc", "abbc" but not "ac"
? Matches 0 or 1 occurrence colou?r matches "color" and "colour"
[abc] Matches any character in the brackets gr[ae]y matches "gray" and "grey"
[^abc] Matches any character not in the brackets [^0-9] matches any non-digit
[a-z] Matches any character in the range [a-z] matches any lowercase letter
\d Matches any digit (0-9) \d{3} matches "123", "456"
\w Matches any word character (a-z, A-Z, 0-9, _) \w+ matches "hello_123"
\s Matches any whitespace character a\sb matches "a b"

Subscribe to TheBuggerUs

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe