Regex tester
Test a regular expression and see matches highlighted live.
How to use the regex tester
- Type your pattern into the Pattern box as bare regex — no surrounding slashes and no string escaping, so a digit run is just
\d+, exactly as you'd write it between/ /in code. - Add flags in the flags field:
i(ignore case),m(multiline anchors),s(dot matches newlines),u,y— anything your browser'sRegExpaccepts. Thegflag is applied for you, so every match is always found. - Paste sample text below. There's no run button — results update on every keystroke in any of the three fields.
- Read the match count, and see each match highlighted in the panel under the text.
- If the pattern is invalid, the browser's own error message appears until you fix it.
Common uses
- Prototype a validation pattern — order numbers, usernames, postal codes — against a pile of real examples before it ships in JavaScript.
- Debug why a pattern misses: paste text it should match and adjust one token at a time, watching the highlights respond.
- Check coverage over a log excerpt: paste fifty lines and confirm the match count equals the number of timestamps or IP addresses you expect.
- Learn regex hands-on — instant per-keystroke feedback makes quantifiers, character classes and anchors click faster than reading about them.
Tips & limitations
- This is JavaScript's regex flavor — the same engine as your browser and Node. Most patterns port to PCRE or Python, but not all: possessive quantifiers and atomic groups don't exist in JavaScript, so grep- or Java-flavored patterns may need tweaks.
- Don't paste
/pattern/giwholesale — the slashes would be treated as literal characters to match. The pattern goes in the first box, flags in the second. - Only whole matches are highlighted: capture groups aren't broken out separately, and there's no replace preview — for those, reach for your browser console or actual code.
- Zero-length matches are skipped, so a pattern like
a*only shows its non-empty matches, and a safety cap stops runaway loops after 200,000 iterations. - Catastrophic backtracking can still freeze the tab: a nested-quantifier pattern like
(a+)+$against a long non-matching string runs on the page's main thread, and no guard can interrupt the engine mid-match.
How it's built & why it's safe
Matching runs on the browser's built-in JavaScript RegExp engine via new RegExp(pattern, flags) — identical behavior to the code you'll ship, which is the whole point of testing here. The page is one ~25-line script: it executes the pattern, counts the matches and wraps each one in a highlight, all locally. Neither your pattern nor your test text ever leaves the browser, so it's safe to paste production log lines or user data as test input.
Related tools: Diff Checker · Case Converter · Lorem Ipsum
Further reading: Why Toolkit runs entirely in your browser (and why that matters)
Frequently asked questions
Which regex flavor is this?
JavaScript's, as implemented by your browser — the same engine your front-end code and Node scripts use. The syntax overlaps heavily with PCRE, but if the pattern is destined for grep, Python or Java, verify it in that environment too.
Why aren't my capture groups shown?
The tester highlights full matches only and doesn't break out groups or named captures. Groups still work for matching purposes; to inspect what they captured, run the same pattern with match() or exec() in your browser's console.
Why does it say my pattern is invalid?
That message comes straight from your browser's regex parser. The usual culprits are an unmatched parenthesis or bracket, a trailing backslash, or a flag the browser doesn't accept — fix the pattern and results reappear instantly.
Can I test find-and-replace?
No — this page only finds and highlights matches; there's no substitution preview. Test the matching half here, then try your replacement with String.replace() in the console or your code.
Do I need to add the g flag?
It's applied automatically, so all matches are always found and counted. The other flags behave normally — add i for case-insensitive matching, m to make ^ and $ work per line, or s to let the dot cross newlines.
Is my pattern or test text sent anywhere?
No — matching happens entirely in your browser, and nothing is stored or transmitted. That makes it safe to paste real log lines, emails or user-generated content as test input.