zahubtech@local $ regex-tester --live
Regex Tester — test regular expressions online
This regex tester runs your regular expression against a test string live in the browser, highlighting every match as you type and breaking out each capture group. It is the fast way to test a regex online, debug why a pattern is not matching, and confirm what your capture groups actually capture before you paste the expression into code.
It uses the native JavaScript `RegExp` engine, so the syntax and flags behave exactly as they will in a browser or Node.js — `g` for global, `i` for case-insensitive, `m` for multiline, `s` for dotAll, and `u`/`y` when you need them. Everything matches entirely in your browser; nothing you paste is uploaded.
Usage
- Type your pattern into the pattern field (the slashes around it are shown for you — enter only the body, e.g. `\w+@\w+\.\w+`).
- Set the flags in the small box on the right: `g` to find every match, `i` for case-insensitive, `m` for multiline, `s` so `.` matches newlines.
- Paste or edit the test string in the text area. Matches are highlighted live and the counter shows how many were found (or the compile error if the pattern is invalid).
- Read the capture-groups list below the matches — each match is listed with group 1, group 2, … so you can verify the parentheses in your regular expression capture what you expect.
Examples
- Match an email address with capture groups:
(\w+)@(\w+\.\w+) - Two capturing groups: `(\w+)` grabs the local part before the `@`, and `(\w+\.\w+)` grabs the domain. With the `g` flag every email in the test string is highlighted, and each match lists group 1 (local part) and group 2 (domain) — a quick way to test regex capture groups.
- Find a word case-insensitively:
error - Add the `i` flag to match `error`, `Error` and `ERROR` alike. Drop `g` to highlight only the first match, or keep `g` to count and highlight every occurrence — the match counter updates live as you edit the pattern or flags.
- Match a date with a named-style group structure:
(\d{4})-(\d{2})-(\d{2}) - Matches an ISO date like `2026-06-14` and splits it into three groups: year, month and day. `\d{4}` means exactly four digits; `{2}` means exactly two. The groups list shows `2026`, `06`, `14` so you can confirm the quantifiers are right.
- Anchor a full-string match:
^\d{3}-\d{3}-\d{4}$ - The `^` and `
Regex Tester — Test Regular Expressions Online anchors force the whole line to be a US phone number like `555-123-4567` and nothing else. Use the `m` (multiline) flag when your test string has several lines and you want `^`/`Regex Tester — Test Regular Expressions Online to match at each line break.
FAQ
- How do I test a regular expression online?
- Type your pattern into the pattern field above, set the flags, and paste the text you want to match into the test-string box. Matches are highlighted live and capture groups are listed, so you can debug a regex without running any code — everything happens in your browser.
- What do the regex flags g, i, m and s mean?
- `g` (global) finds every match instead of just the first; `i` makes matching case-insensitive; `m` (multiline) lets `^` and `
Regex Tester — Test Regular Expressions Online match at each line break; `s` (dotAll) lets `.` match newline characters too. They go in the small flags box to the right of the pattern. - How do regex capture groups work?
- Each pair of parentheses in your pattern is a capture group, numbered left to right. After a match, the tester lists group 1, group 2 and so on for every match, so you can confirm what each set of parentheses captured. A group that did not participate in the match shows as empty (∅).
- Can I test a regex replacement here?
- This tool focuses on matching and capture groups rather than performing the substitution, but it gives you everything a replacement needs: confirm the pattern matches the right spans and that your groups capture the right pieces, then use them as backreferences ($1, $2, …) in your String.replace call.
- Is this a JavaScript regex tester?
- Yes — it uses the native JavaScript `RegExp` engine, so patterns and flags behave exactly as they do in the browser and Node.js. PCRE-style constructs that JavaScript does not support (such as some lookbehind or recursion features) will report a compile error rather than silently misbehaving.
//
Contact: ada@zahub.com and grace@local.dev
Support: bug-reports@zahub.io
No match: just plain text here.
✓ 3 matches/(\w+)@(\w+\.\w+)/gi
match #1 → group 1: ada · group 2: zahub.com
match #2 → group 1: grace · group 2: local.dev
match #3 → group 1: reports · group 2: zahub.io
Edit the pattern, the flags or the text — it all runs live in your browser.