Regex Tester
Test regular expressions with live match highlighting and flags.
How to Use Regex Tester
Type a regular expression in the pattern field between the slashes. Check the flags (g, i, m, s) as needed.
Add the text you want to match against in the Test String field. Matches are highlighted in real-time.
Click any symbol in the Quick Reference grid to insert it into your pattern automatically.
Use the pre-built patterns for emails, URLs, phone numbers, and more as a starting point.
Features & Benefits
Live Highlighting
All matches are highlighted in color as you type — no submit needed.
Capture Groups
View each capture group from your matches listed clearly below the test string.
All JS Flags
Toggle global, case-insensitive, multiline, and dotAll flags with checkboxes.
Pattern Library
Built-in library of common patterns: email, URL, phone, date, IP address, and more.
About Regex Tester
What Are Regular Expressions?
Regular expressions (regex) are sequences of characters that define a search pattern. They are used in programming, text editing, and data validation to find, match, replace, or split strings. Regex is supported in virtually every programming language including JavaScript, Python, Java, PHP, and Ruby.
JavaScript Regex Flags Explained
- g (global) — Find all matches, not just the first one
- i (case-insensitive) — Match both uppercase and lowercase letters
- m (multiline) — ^ and $ match start/end of each line, not just the full string
- s (dotAll) — The . metacharacter also matches newline characters
Common Regex Patterns
- Email:
[\w.-]+@[\w.-]+\.[a-z]{2,} - URL:
https?:\/\/[\w\-.]+(\\/[\w\-._~:/?#\[\]@!$&'()*+,;=]*)? - Phone (US):
\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4} - Date (YYYY-MM-DD):
\d{4}-\d{2}-\d{2} - Hex color:
#([a-fA-F0-9]{6}|[a-fA-F0-9]{3}) - IP Address:
\d{1,3}(\.\d{1,3}){3}
Regex Special Characters Quick Reference
. any character | \d digit | \w word char | \s whitespace | ^ start | $ end | * 0+ times | + 1+ times | ? optional | {n} exactly n | () group | [] character class | | or
Greedy vs Lazy Matching
By default, quantifiers like * and + are greedy — they match as much as possible. Adding ? after them (e.g. *?) makes them lazy, matching as little as possible. This is important when extracting content between HTML tags or brackets.
Frequently Asked Questions
This tester uses JavaScript's built-in RegExp engine, which supports ES2018 features including named capture groups, lookbehind assertions, and the dotAll (s) flag. It's compatible with Node.js and all modern browsers.
g (global) — find all matches, not just the first. i (case-insensitive) — match uppercase and lowercase alike. m (multiline) — ^ and $ match start/end of each line. s (dotAll) — the . character also matches newlines.
Escape special characters with a backslash. For example, to match a literal dot use \., to match a literal dollar sign use \$, and to match a backslash itself use \\.
Yes. The test string textarea supports multiple lines. Enable the multiline flag (m) so that ^ and $ match the start and end of each line, not just the whole string.