Regex Tester — Live Regular Expression Testing
Write and test regular expressions live. Matches are highlighted as you type. Supports all standard JavaScript regex flags — global, case-insensitive, multiline, dotall.
Quick Regex Reference Guide
The most commonly used regex patterns and what they match:
| Pattern | Matches |
|---|---|
| \d | Any digit (0–9) |
| \w | Any word character (a–z, A–Z, 0–9, _) |
| \s | Any whitespace (space, tab, newline) |
| . | Any character except newline |
| ^ | Start of string (or line with m flag) |
| $ | End of string (or line with m flag) |
| [abc] | Any of a, b, or c |
| [^abc] | Any character except a, b, c |
| a{3} | Exactly 3 consecutive a's |
| a{2,5} | 2 to 5 consecutive a's |
| (foo|bar) | Either 'foo' or 'bar' |
| (?=...) | Positive lookahead |
Common Regex Patterns for Developers
Email Validation
Indian Phone Number
URL Matching
IP Address (IPv4)
Date (YYYY-MM-DD)
Frequently Asked Questions
What regex flavor does this tester use?
This tester uses JavaScript (ECMAScript) regular expressions, which covers the vast majority of use cases. JavaScript regex is supported in all major browsers and is compatible with regex patterns used in TypeScript, Node.js, and many other languages.
What do the regex flags g, i, m, s mean?
g (global) finds all matches, not just the first. i (case-insensitive) treats uppercase and lowercase as equal. m (multiline) makes ^ and $ match start/end of each line, not just the whole string. s (dotall) makes the dot . match newlines as well.
How do I match an email address with regex?
A common email regex pattern is: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$. Note that a truly comprehensive email regex is complex — for production use, consider validating email format with a dedicated library after basic regex pre-filtering.
What is the difference between .* and .+?
. matches any character except newline. * means zero or more of the preceding element. + means one or more. So .* matches an empty string or any characters, while .+ requires at least one character.
How do capture groups work?
Parentheses () create capture groups that extract specific parts of a match. For example, (\d{4})-(\d{2})-(\d{2}) applied to '2026-04-29' captures three groups: year '2026', month '04', day '29'. Named capture groups use (?<name>...).
What is the difference between greedy and lazy quantifiers?
Greedy quantifiers (* +) match as much as possible. Lazy quantifiers (*? +?) match as little as possible. For example, on '<b>text</b>', <.+> (greedy) matches the entire string, while <.+?> (lazy) matches only '<b>'.