Write a regular expression, watch every match light up, and finally understand what each token does.
Type a pattern and watch every match light up in your test text โ with indexes, capture groups and a plain-language explanation of what the pattern actually does.
Start typing a pattern and its pieces will be explained here.
Tip: paste your own text first, then try a pattern against it.
Pattern working? โ it keeps the pattern, flags and test text so you can reuse it any time.
| Token | Means | Example |
|---|---|---|
| \d | Any digit 0โ9 | \d{4} โ 2026 |
| \w | Letter, digit or underscore | \w+ โ hello_42 |
| \s | Whitespace | a\sb โ "a b" |
| . | Any character except newline | h.t โ hat, hot |
| [abc] | One of a, b or c | [aeiou] โ any vowel |
| [^abc] | Anything EXCEPT a, b or c | [^0-9] โ not a digit |
| + | One or more | go+gle โ google |
| * | Zero or more | ab*c โ ac, abc, abbc |
| ? | Optional (zero or one) | colou?r โ color, colour |
| {n,m} | Between n and m times | \d{2,4} โ 42, 2026 |
| ^ / $ | Start / end anchors | ^\d+$ โ digits only, whole string |
| ( ) | Capture group (saved as $1, $2โฆ) | (\d+)-(\d+) โ year-month |
| | | OR | cat|dog โ either word |
| \b | Word boundary | \bcat\b โ the word cat only |
Uppercase flips the meaning: \D = not a digit, \W = not a word character, \S = not whitespace. Add ? after a quantifier (+?, *?) to make it lazy โ match as little as possible instead of as much as possible.
Patterns you have fought for and won โ keep them here with their flags, test text and your own notes. Records are saved under your local account (or guest space) on this device โ create, view, edit and delete them any time.