Regex Tester
Test regular expressions in real time. See matches highlighted in your text, capture groups, and match positions. Common patterns library included.
Matches will appear here…
Essential regex patterns for developers
Copy any of these into the tester above to see it match against your input:
| Pattern | Matches | Flags |
|---|---|---|
| /^[\w.-]+@[\w.-]+\.\w{2,}$/ | Email address | i |
| /https?:\/\/[^\s]+/ | URL (http/https) | g |
| /^\+?[1-9]\d{6,14}$/ | International phone | — |
| /^#([a-f0-9]{6}|[a-f0-9]{3})$/ | Hex color | i |
| /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/ | ISO date (YYYY-MM-DD) | — |
| /\b(?:\d{1,3}\.){3}\d{1,3}\b/ | IPv4 address | g |
| /^[a-z][a-z0-9-]*$/ | Slug / URL-safe string | i |
| /^[a-zA-Z_$][\w$]*$/ | Valid JS identifier | — |
Regex flags explained
g(global) — find all matches, not just the first onei(case insensitive) — treat uppercase and lowercase as equalm(multiline) —^and$match the start/end of each line, not just the whole strings(dotall) —.matches newline characters too, useful for multi-line blocks
Using regex in JavaScript
const email = /^[\w.-]+@[\w.-]+\.\w{2,}$/i;
// Test if a string matches
email.test("user@example.com"); // true
// Extract all matches from a string
const text = "Contact alice@x.com or bob@y.org";
text.match(/[\w.-]+@[\w.-]+\.\w{2,}/g);
// → ["alice@x.com", "bob@y.org"]
// Replace matches
"Hello World".replace(/\b\w/g, c => c.toLowerCase());
// → "hello world"Related Tools
Frequently Asked Questions
What regex flavor does this tool use?
This tool uses JavaScript's built-in RegExp engine, which is the same regex flavor used in Node.js, browsers, and most web applications. It supports flags g (global), i (case insensitive), m (multiline), and s (dotall).
What are capture groups?
Capture groups are portions of a regex pattern enclosed in parentheses (). When a match is found, the tool shows each group's captured text separately, making it easy to extract specific parts of a match.
Does the tool include common regex patterns?
Yes. Click the 'Patterns' button to see a library of common patterns including Email, URL, IP address, phone number, hex color, date, HTML tag, and digits-only patterns.
Is this a good alternative to regex101?
Yes. This tool offers real-time matching, highlighted preview, capture group display, and a common patterns library — all running client-side with a clean, modern UI and no ads.