Regex · Developer Tools
Regex Tester Online: Test Regular Expressions Instantly
Master regex faster with a live tester. This guide covers syntax, flags, common patterns, and how to use our free tool.
7 min read → Open Regex Tester
What is a Regular Expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. Use them to validate input, extract data, find and replace text, and parse strings.
Regex Syntax Quick Reference
| Pattern | Matches |
|---|---|
. | Any character except newline |
\d | Any digit (0-9) |
\w | Word character (a-z, A-Z, 0-9, _) |
\s | Whitespace (space, tab, newline) |
^ | Start of string |
$ | End of string |
* | 0 or more of preceding |
+ | 1 or more of preceding |
? | 0 or 1 of preceding (optional) |
{n} | Exactly n times |
[abc] | Character class (a, b, or c) |
(group) | Capture group |
a|b | a or b |
Common Regex Flags
g — Global: find all matches (not just the first) i — Case insensitive m — Multiline: ^ and $ match line boundaries s — Dotall: . matches newlines too
20 Essential Regex Patterns
# Email address
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
# URL
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}
# Phone number (US)
^\+?1?\s?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$
# IP address (IPv4)
^(\d{1,3}\.){3}\d{1,3}$
# UUID
[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
# Hex color
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
# Date (YYYY-MM-DD)
^\d{4}-\d{2}-\d{2}$
# Strong password (8+ chars, upper, lower, digit, special)
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
How to Use the Regex Tester
- Open the Regex Tester tool
- Enter your pattern in the Regex field (without surrounding slashes)
- Select your flags (g, i, m)
- Paste your test string — matches highlight in real time
- Check the Match Results panel for captured groups
Debugging Regex
- No matches? Check if you need the
g flag. Without it, only the first match is returned. - Greedy vs lazy?
.* is greedy (matches as much as possible). Use .*? for lazy matching. - Special characters? Escape them with
\. A literal dot is \. not .
Related Tools