Regex tester

Write a regular expression and watch every match, capture group and replacement update as you type. It uses your browser's own JavaScript engine, so what matches here matches in your code - and the text you test never leaves this page.

How to use the regex tester

Type a pattern in the top box - without the surrounding slashes - and paste the text you want to search below it. Matches are highlighted immediately, and the table lists each one with its position and every capture group. Turn on Replace to see what String.replace() would produce, using $1, $<name> or $& for the whole match.

The Copy link button puts the pattern, flags and text into the address itself, after the #. That part of a URL is never sent to a web server, so you can share a test case without it being stored anywhere.

Regex flags explained

FlagNameWhat it does
gglobalFind every match instead of stopping at the first
iignore casea also matches A
mmultiline^ and $ match at the start and end of each line
sdot all. also matches line breaks
uunicodeTreats the pattern as Unicode and enables \p{L}-style property escapes
ystickyEach match must start exactly where the last one ended
dindicesRecords where each group starts and ends

For the syntax itself, keep the regex cheat sheet open in another tab.

Why a pattern can freeze a page

Some patterns take exponentially longer as the text grows - the classic example is (a+)+$ run against a long string of as that ends in something else. The engine tries every way of splitting the input between the two quantifiers before giving up. This is called catastrophic backtracking, and it is the cause of real outages.

The tester runs every pattern in a separate worker and stops it if it takes more than a fraction of a second, telling you instead of hanging the tab. If you see that warning, look for a quantifier nested inside another one and make the inner part more specific.

Which regex flavour this is

This is the JavaScript (ECMAScript) flavour, exactly as your browser runs it, including lookbehind, named groups and Unicode property escapes. It is also what TypeScript, Node.js, Deno and most front-end tooling use. Other flavours - PCRE in PHP, Python's re, .NET and Java - agree on the basics but differ in details such as possessive quantifiers, inline flags and recursion.

How your files stay private

Most free converters upload your file, process it on their server and send the result back - so a copy of it passes through somebody else's machine. This page does all of the work in your browser instead. The files you choose are read into memory on your own device, processed there and handed back as a download; none of their contents is transmitted. You can switch off Wi-Fi after the page has loaded and it keeps working.

Frequently asked questions

Is the text I test sent anywhere?

No. The pattern runs in your browser's JavaScript engine and the text stays on the page. Even the share link keeps everything after the # in the address, a part of the URL browsers never send to a server.

Which regex flavour does this tester use?

JavaScript (ECMAScript), as implemented by the browser you are using. That makes it exact for JavaScript, TypeScript and Node.js code; PHP, Python and Java patterns are very similar but differ in some advanced features.

How do I use a capture group in the replacement?

Turn on Replace and refer to groups by number with $1, $2 and so on, by name with $<name>, or to the whole match with $&. Use $$ for a literal dollar sign.

Why does my pattern only find one match?

Without the g (global) flag, a regular expression stops after the first match. Tick g to find them all.

What does "stopped - catastrophic backtracking" mean?

The pattern was taking so long that it would have frozen the page, usually because of a quantifier inside another quantifier, such as (a+)+ or (.*)*. Rewrite that part so it cannot match the same text in many different ways.