Regex Tester
\d{3}→'\d' exactly 3 times-→Literal "-"\d{4}→'\d' exactly 4 times| # | Full Match | Groups | Position | Action |
|---|---|---|---|---|
| 0 | 555-1234 | — | 5–13 | |
| 1 | 555-5678 | — | 17–25 |
This tool is part of these guided projects. Each project provides step-by-step instructions with checklists and all the tools you need in one place.
Tools you might need next
Look up HTTP status codes. 200, 404, 500 etc. Get description and category. Free developer utility that runs locally in your browser — fast, private, and no
Validate JSON syntax. Check for errors. Get validation result. Essential for developers. Free developer utility that runs locally in your browser — fast
Encode text for URLs. Percent encoding. For query strings and links. Free developer utility that runs locally in your browser — fast, private, and no server
Patterns are evaluated using JavaScript's RegExp engine (ECMAScript standard). Syntax follows JS conventions: \d for digits, \w for word characters, ^ and $ for anchors, and (?...) for groups and lookaheads.
Common flags modify matching behavior: g (global, find all matches), i (case-insensitive), m (multiline ^/$), s (dotall, . matches newlines), u (Unicode), and y (sticky).
Quantifiers (*, +, ?, {n,m}) control how many times a preceding element repeats. By default they are greedy (match as much as possible). Append ? for lazy matching (match as little as possible).
Updated: July 2026
Test a regex that matches common email formats before adding it to a form validator.
→ Highlights valid emails; rejects malformed addresses
Use a capture group to pull ISO dates (YYYY-MM-DD) from server log lines.
→ Group 1 captures each date match
Test a pattern that accepts common US phone formats with optional country code and separators.
→ Matches (555) 123-4567 and +1-555-123-4567
Characters like . * + ? [ ] ( ) { } | \ ^ $ have special meaning. Use \ to match them literally. A dot (.) matches any character; \. matches a literal period.
Python, Java, PCRE, and JavaScript differ on features like lookbehind support and word boundaries. Test with the engine your production code uses — this tool uses JavaScript RegExp.
Build and debug regular expressions without leaving your browser. Enter a pattern and test string to see all matches, capture groups, and match indices highlighted in real time — essential for validation, parsing, and search-and-replace tasks.