Regular expressions look like a cat walked on the keyboard — ^\d{4}-\d{2}$ — but they're just a search language. Learn eight symbols and you can find emails, dates, phone numbers and codes in any text.
The eight symbols that matter
| Symbol | Means | Example |
|---|---|---|
. | any single character | c.t matches cat, cut, c9t |
\d | any digit | \d\d matches 42 |
\w | letter, digit or _ | \w+ matches a word |
+ | one or more of the previous | \d+ matches 2026 |
* | zero or more | a* matches "", a, aaa |
? | optional | colou?r matches color & colour |
[ ] | any one of these | [aeiou] matches a vowel |
^ $ | start / end of line | ^Total matches lines starting with Total |
Type a pattern, paste text, and watch matches highlight as you type.
Open Regex TesterThree recipes you'll actually use
Find every email address
[\w.-]+@[\w.-]+\.\w+ — one or more word characters (plus dots/hyphens), an @, a domain, a dot, and a suffix. Not RFC-perfect, but catches real-world emails reliably.
Find dates like 2026-07-14
\d{4}-\d{2}-\d{2} — the {4} means "exactly four". Change separators to match \d{2}/\d{2}/\d{4} for US-style dates.
Find prices
\$\d+(\.\d{2})? — a dollar sign (escaped, since $ is special), digits, and an optional cents part. Parentheses group; ? makes the group optional.
The escaping rule
Characters that have special meaning — . + * ? $ ( ) [ ] — must be prefixed with a backslash to match literally. Searching for "3.14" as 3.14 also matches "3514"; write 3\.14 instead. When a pattern misbehaves, an unescaped dot is the culprit more often than anything else.
Learn by doing
Regex only sticks with practice. Paste any real text into the Regex Tester and build patterns incrementally — start with a literal word, add one symbol at a time, and watch what the highlight does. For find-and-replace jobs across two texts, the Diff Checker guide covers the companion workflow.