Regex Tester
Test regular expressions with live match highlighting and group capture.
//
Highlighted (2 matches)
Contact us at [email protected] or [email protected] any time.
Match details
- Group 1:
hello - Group 2:
example - Group 3:
com
- Group 1:
sales - Group 2:
example - Group 3:
org
Build and test JavaScript regular expressions
Regular expressions are compact, powerful, and famously fiddly. A regex tester lets you iterate on a pattern with live feedback, so you can confirm it matches what you intend without deploying it into your code first. This tester uses the JavaScript RegExp engine — the exact same one your browser (and Node.js) will run.
What the tester shows
- Live highlighting. Every match is visually highlighted in your test string.
- Match count. Total number of matches found.
- Per-match details. Starting index and every captured group.
- Error messages. If your pattern has a syntax error, you see the exact message the browser gives.
Useful patterns to try
\b\w+@\w+\.\w+\b— emails in free-form text.(\d{4})-(\d{2})-(\d{2})— ISO dates with year/month/day as groups.#([A-Fa-f0-9]{6})— CSS hex colors.^(?!.*password).*$with flagm— negative look-ahead per line.
Differences from other regex flavors
JavaScript’s regex differs from PCRE (used in most server-side languages):
- No named back-references until ES2018 (
(?<name>...)and\k<name>). - No
\Aor\Z— use^and$instead. - Unicode property escapes (
\p{...}) require theuflag.
Test here, deploy with confidence.
Frequently asked questions
- Which regex flavor does this tester use?
- JavaScript (ECMAScript) regular expressions. The flavor supported by the browser's built-in `RegExp` engine. This differs slightly from PCRE (used by most other languages) — for example, look-behinds have different support and some character-class syntax differs.
- What do the flags mean?
- `g` global (find all matches), `i` case-insensitive, `m` multiline (`^` and `$` match at line breaks), `s` dotall (`.` matches newlines), `u` unicode-aware, `y` sticky. Global is enforced by the tester so every match is shown.
- Can I use capture groups?
- Yes. Parentheses in the pattern create capture groups. The tester shows the matched substring for each group in every match. Use `(?:...)` for non-capturing groups when you just need grouping for alternation.