Regex Tester — what it does
Tests a regular expression against your sample text and shows every match with its groups highlighted — including the matches a lookahead consumed or a lookahead-free engine skipped. Stop iterating against "does it match?" in your head: paste the real text (log lines, CSV rows, HTML fragments), write the pattern, see the matches instantly. Nothing is sent anywhere.
How to use Regex Tester
- Paste your sample text — real data, not an idealised example.
- Write the pattern; flags (g, i, m, s, u) are toggled individually.
- Every match shows with start/end position and each capture group's value — empty groups are marked, not hidden.
- Hover a highlight to see why it matched (which alternative, which backtracking path).
- When the matches are right, copy the pattern into your code — the exact behaviour you saw is what JavaScript will run.
Worked example: the phone-number pattern that ate whitespace
You need Indian mobile numbers out of a complaints log where they appear as "+91 98765 43210 (Ravi)". Pattern: \+91\s+\d{5}\s\d{5}. Test against ten pasted lines: eight matches, two logs use hyphens instead of spaces — you see it immediately, adjust to \s*[\s-]\s*, and the production filter works the first time it runs.
At a glance
| Input | Sample text (any size) + a JavaScript regex |
|---|---|
| Output | Every match with positions and groups; global flag honoured |
| Flags | g, i, m, s, u, y selectable individually |
| Where it runs | The browser's own regex engine — identical semantics to your app |
| Offline | Yes, after first load |
Frequently asked questions
- What is Regex Tester?
- Test regular expressions against sample text with a list of every match and group.
- Is Regex Tester free to use?
- Yes — Regex Tester is free to use, with no sign-up, no install and no account.
- Does Regex Tester upload or store my data?
- No — Regex Tester runs entirely in your browser, so your text, files and results never leave your device.
- Do I need to install anything to use Regex Tester?
- No — it works in any modern browser (Chrome, Edge, Firefox, Safari) with no downloads, accounts or plugins.
- My regex works here but fails in Python/Go. Why?
- It works here but fails elsewhere because engines differ: JavaScript and most engines share PCRE-ish patterns, but Go's RE2 removes backreferences and lookbehind, and some Python builds differ on Unicode groups. Test in the target language's engine — take the semantics of this tool as the JavaScript truth.
- How do I test a pattern with catastrophic backtracking risk?
- Paste a large realistic sample (thousands of lines) rather than the small one. A vulnerable pattern will visibly hang here too; a safe pattern returns in milliseconds. This also proves it is safe before it eats your production workers.
- Can I extract all matches as a list?
- Yes — with the global flag on, the match list is copyable as plain lines (one match per line, groups tab-separated), ready to paste into a spreadsheet or script.