Regex Tester
Test JavaScript regular expressions instantly in your browser. Build and debug patterns with live match highlighting, capture groups, named groups and match indices — plus a JavaScript replacement preview and a hard timeout that stops catastrophic backtracking. Private, no uploads.
Regular Expression
//g
Hard limit 5,000 matches.
JavaScript tokens: $&, $1, $<name>.
Results
Ready
Regex syntax follows JavaScript regular expressions. Expressions run in a Web Worker and are compiled with new RegExp() — never eval — so your text is never executed as code.
Everything runs locally in your browser. Your pattern and test text never leave your device, and no data is uploaded.
Expressions with catastrophic backtracking are interrupted by a hard timeout, so the page never freezes. Regex is for matching text, not for security — never rely on a regular expression as your only input filter.
How it works
- 1Enter a pattern and flags. Type a JavaScript regular expression and toggle the flags you need — global, case-insensitive, multiline, dotAll, Unicode, sticky, and the d (indices) and v (Unicode sets) flags when your browser supports them.
- 2Add test text. Paste up to 500,000 characters of text to search. Optionally add a replacement string using JavaScript tokens such as $&, $1 or $<name> to preview text.replace().
- 3Run the test. Click Test Regex (or press Ctrl+Enter). The expression is compiled with new RegExp() inside a Web Worker, and matches, capture groups, named groups and indices are returned without ever blocking the page.
- 4Inspect, copy or download. Review highlighted matches, groups and a replacement preview, copy the pattern or any match, and download a regex-results.json file — all locally in your browser.
Best practices
- Remember that regex syntax follows JavaScript regular expressions — behavior that differs in PCRE, Python, .NET or Java is not replicated.
- Turn on the global (g) flag to find every match; with global off the tool reports only the first match, which is often all you need when debugging.
- Use the d flag to see the start and end indices of every capture group directly in the highlighted text.
- Use the Unicode (u) flag for Unicode property escapes such as \p{L} and \p{Script=Tamil}, and keep the v flag for advanced Unicode sets when your browser supports it.
- Test text up to 500,000 characters is supported, and match collection stops at the configured limit to keep results readable.
- Expressions with catastrophic backtracking are interrupted by a hard timeout, so the page never freezes — but avoid patterns like (a+)+$ on long inputs anyway.
- Regex is for matching text, not for security — never rely on a regular expression as your only input filter or sanitizer.
- Everything runs locally in your browser in a Web Worker — nothing is uploaded, and your text is never executed as code.
Frequently Asked Questions
What does Regex Tester do?
Which regex syntax is supported?
What do the flags mean?
How do I see the index of each match?
What are capture groups and named groups?
How does the replacement preview work?
Why does the tool time out on some expressions?
What does a zero-length match mean?
Can I match Tamil or other Unicode text?
Is my pattern or text uploaded anywhere?
Is regex a security tool?
Related Tools
Supported expressions
Test any JavaScript regular expression — literals, character classes, anchors, quantifiers, alternation, lookarounds, backreferences, and Unicode property escapes such as \p{L} and \p{Script=Tamil} — directly in your browser. All standard flags are supported (g, i, m, s, u, y), plus the d (match indices) and v (Unicode sets) flags when the runtime accepts them. Up to 500,000 characters of test text and up to 5,000 matches per run are supported, with a hard timeout that interrupts catastrophic backtracking. The expression is compiled with new RegExp() — never eval — inside a Web Worker.
Privacy & data removal
Your pattern and test text are evaluated entirely in your browser inside a Web Worker and are never uploaded to any server. No account is required to use the Regex Tester, we never store or share your patterns or text, and your input is never executed as code.
