Regex Tester

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.

Instant
Processing
Private
Browser First
Free
No Signup

Regex Tester

/ /

JavaScript regex only — see how this differs from PCRE/Python.

Go to error

or Ctrl+Enter

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
More options: Replace
Use $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.

  • No possessive quantifiers (a++) and no atomic groups ((?>...)).
  • No \A / \Z anchors — use ^ / $ with the m flag instead.
  • No recursive patterns.
  • Lookbehind ((?<=...), (?<!...)) and named capture groups ((?<name>...)) are supported.
Advertisement

728 x 90 In-Content Ad

About This Tool

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.

Highlights every match instantly as you type or change flags, debounced so typing never lags behind
Shows a full match table -- index, numbered groups, and named groups -- for every match, not just the first
Supports named capture groups like (?<year>\d{4}) and lookbehind like (?<=\$)\d+, both genuinely parsed rather than accepted and ignored
Runs matching in a background Web Worker with a 1-second timeout, so a catastrophically backtracking pattern like (a+)+ gets stopped instead of freezing the tab
Previews the exact replace() output live, using real JavaScript replacement syntax: $1, $<name>, $&, and $$
Opens a local text file or accepts one dropped onto the test box, with no account or cloud save required

How to Use Regex Tester

1

Write your pattern

Type or paste your regular expression into the field between the two slashes, or click Try an example to load a worked sample instead.

2

Set the flags

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.

3

Add your test text

Paste or type the text to test against into Test text, or click Open file or drop a file onto that box.

4

Read the results

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>.

5

Clear when you're done

Click Clear to reset the pattern, flags, and test text together.

Frequently Asked Questions

Is this tool completely free?

Yes! All our tools are 100% free to use with no hidden costs, no registration required, and no credit card needed.

Is my data safe and private?

Absolutely. All tools run entirely in your browser (client-side). Your data never leaves your device and is not sent to our servers.

Can I use this tool offline?

Yes, once the page is loaded, the tool will continue to work even if you lose internet connection since it runs in your browser.

Is there a character limit?

There is no strict character limit, but very large amounts of text (100,000+ characters) may slow down your browser.

Can I use this for commercial projects?

Yes! All our tools are free for both personal and commercial use.

Is this a PCRE or Python regex tester?

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.

Why did my pattern stop after 1 second?

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.

Why doesn't \p{L}+ match any letters?

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.

What's the difference between .test() and .match() here?

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.

Can I use named capture groups?

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.

What replacement syntax does the Replace box use?

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.

What does the sticky (y) flag actually change?

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.

Why doesn't ^ or $ match where I expect with Windows line endings?

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.

Does this tool support lookbehind?

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.