Regex Tester
TextFree · PrivateTest regular expressions live with match highlighting, capture group tables, and replace preview. Includes a cheatsheet of common patterns. 100% in-browser.
What is a Regex Tester?
A regex tester (regular expression tester) lets you write and debug regular expressions against real input without writing code. You see matches highlighted live as you type the pattern, making it easy to refine your expression until it matches exactly what you intend — and nothing it shouldn't.
This tester uses the JavaScript regex engine built into your browser, supporting modern ES2018+ features: named capture groups, lookbehind assertions, dotall mode (s flag), and Unicode mode (u flag).
How to use this Regex Tester
- Enter your regular expression in the pattern bar. The
/slashes/are decorative — just type the pattern. - Toggle flags (
g,i,m,s,u) using the buttons to the right of the pattern bar. - Paste your test string below. Matches are highlighted in real time with colour-coded spans.
- Expand Capture groups to see a table of all group matches by name or index.
- Expand Replace preview to test a replacement string with backreferences (
$1,$<name>). - Load a pattern from the Cheatsheet as a starting point, then customise it.
Regex flag reference
- g
- Global — find all matches, not just the first.
- i
- Case-insensitive —
Hellomatcheshello. - m
- Multiline —
^and$match line start/end. - s
- Dotall —
.matches newline characters too. - u
- Unicode — enables full Unicode matching and escapes.
Why test regex in the browser privately?
Log lines, error messages, and test data you paste into a regex tester often contain sensitive details: user IDs, IP addresses, API responses, PII from support tickets. This tester runs entirely client-side — your test strings are never sent to any server. The pattern URL-sharing feature uses LZ-string compression in the URL hash (not the query string), keeping the canonical URL clean for bookmarking and sharing.
Frequently Asked Questions
How do I test a regular expression online?
How do I see capture groups?
Can I preview a regex replace?
What regex flavors are supported?
Related Tools
Compare two texts side-by-side or inline. Word, character, and line diff modes, ignore-whitespace and ignore-case toggles. Your content never leaves your browser.
Format, beautify, and minify JSON instantly in your browser. Syntax highlighting, error detection, sort keys, and one-click Fix. Your data never leaves your device.