Test a JavaScript regular expression against your own text: live highlighted matches, a numbered/named capture-group table, and a replace preview -- all in your browser, with a built-in 1-second timeo Fast, free, and built for simple browser-based workflows.
JavaScript regex only — see how this differs from PCRE/Python.
Your pattern and test text are matched entirely in this browser tab, in a background worker with a 1-second safety timeout. Nothing is sent anywhere.
Type a regular expression above, or try the example.
| # | Index | Text | Groups | Named groups |
|---|
$1, $<name>, $&, $$ exactly as in JavaScript's String.prototype.replace.How JavaScript regex differs from PCRE / Python
This tool runs JavaScript's own regular expression engine — the same one
every modern browser and Node.js use — not PCRE (PHP, and the default engine most other online
testers use) and not Python's re module.
a++) and no atomic groups ((?>...)).\A / \Z anchors — use ^ / $ with the
m flag instead.(?<=...), (?<!...)) and named capture groups
((?<name>...)) are supported.728 x 90 In-Content Ad
Regex Tester is a free online tool that runs a JavaScript regular expression against your text and shows exactly what it matches. Type a pattern, paste or drop in text, and see every match highlighted instantly, with its numbered and named capture groups -- no installation and nothing sent to a server.
Reach for it when you're building a pattern for a signup form's email field, writing a log-parsing script and need to confirm a date format actually matches, cleaning a CSV where some rows use commas and others semicolons, or debugging why a replace() call in production isn't touching every match. Typing a pattern straight into your own code and rerunning the whole script to see if it worked is slow; testing it here first, against real sample text, catches the mistake before it ships.
Matching runs entirely in your browser, in a background worker thread, so neither your pattern nor your test text is ever sent anywhere -- useful when you're testing a regex against real log lines, customer data, or anything else you wouldn't want to paste into a site you don't control. The worker also means a runaway pattern can be stopped automatically instead of freezing the tab.
Type or paste your regular expression into the field between the two slashes, or click Try an example to load a worked sample instead.
Tick the flag checkboxes you need -- g, i, m, s, u, y, d, v -- just below the pattern. Global (g) is on by default so every match is found, not just the first.
Paste or type the text to test against into Test text, or click Open file or drop a file onto that box.
Matches highlight in the box below and list in the table with their index and any numbered or named groups. Open More options: Replace to try a replacement with $1 or $<name>.
Click Clear to reset the pattern, flags, and test text together.
Yes! All our tools are 100% free to use with no hidden costs, no registration required, and no credit card needed.
Absolutely. All tools run entirely in your browser (client-side). Your data never leaves your device and is not sent to our servers.
Yes, once the page is loaded, the tool will continue to work even if you lose internet connection since it runs in your browser.
There is no strict character limit, but very large amounts of text (100,000+ characters) may slow down your browser.
Yes! All our tools are free for both personal and commercial use.
No -- this tool runs JavaScript's own regular expression engine only, the same one Chrome, Firefox, and Node.js use. It does not support PCRE (PHP's default) or Python's re module, which differ in things like possessive quantifiers, atomic groups, and \A/\Z anchors -- the comparison below the results spells out the exact differences.
To stop the tab from freezing. Matching runs in a background worker with a 1-second timeout, and a pattern that backtracks catastrophically -- nested quantifiers like (a+)+ against a long non-matching string -- can take far longer than that to finish. When it times out, the worker is killed and a fresh one starts for your next attempt.
Because the u flag isn't checked. Without it, JavaScript does not treat \p as a Unicode property escape -- it silently reads \p as a literal "p" and {L} as literal characters, so the pattern compiles without error but matches nothing on ordinary text. Tick the u (or v) flag and \p{L}+ will match runs of letters correctly.
This tool always shows you what matchAll() would find -- every match, its position, and its groups -- not a plain yes/no answer. In your own code, .test() only tells you whether a pattern matches at all (true or false), while .match() or .matchAll() return the actual matched text, the same information this page's table shows.
Yes. Write (?<name>...) in your pattern -- for example (?<year>\d{4}) -- and the match table shows a separate Named groups column alongside the numbered ones, so you don't have to count parentheses to work out which group is which.
The same as JavaScript's String.prototype.replace(): $1, $2 for numbered groups, $<name> for a named group, $& for the whole match, and $$ for a literal dollar sign. Open More options: Replace and type a replacement to see the result update live.
It restricts matching to exactly where the regex's internal position points, instead of searching ahead for the next match anywhere in the text. With y checked, a pattern that doesn't match right at the start of the test text returns no matches at all, even if it would match further along.
JavaScript's $ (with the m flag) matches before a \n, not before \r. If your test text uses Windows-style CRLF line endings, a line ending in \r\n leaves a stray \r that $ won't match before, so a pattern like ^\w+$ can miss lines that look fine visually. Converting the text to \n-only line endings fixes it.
Yes. Both (?<=...) positive and (?<!...) negative lookbehind are fully supported, alongside lookahead ((?=...), (?!...)). Lookbehind is one of the newer additions to JavaScript regex and isn't available in every older engine, but it works here.