←
Developer

Regex Tester

Loading the tool…

Ready when you are.Runs in this browser · nothing is uploaded

Test regex with matches, groups, replace

  • Free
  • No sign-up
  • No upload
  • Works offline

Tool facts

Opens
TXTLOG
Price
Free, no sign-up, no watermark
Are files uploaded?
No. Everything is processed in this browser, on your device.
Batch processing
One file at a time
Offline use
Works without a connection once this page has loaded
Built with
Web Workers
Browser
A recent Chrome, Edge, Firefox or Safari, on computer or phone.

Check it yourself: press F12, open the Network tab, then use the tool. No request carries your data.

About Regex Tester

This regex tester runs a JavaScript regular expression against your text and highlights every match as you type. Each match is listed with its start and end index, its numbered capture groups ($1, $2…) and its named groups, and a replace preview shows the result of String.prototype.replace with your replacement pattern, so you can check $1, $<name> and $& substitutions before putting them in code.

The tester uses your browser's own RegExp engine, so results are exactly what JavaScript in Chrome, Firefox, Safari or Node.js will produce, including lookbehind, named groups and Unicode property escapes like \p{L} with the u flag. Turn the flags g (global), i (ignore case), m (multiline), s (dotAll), u (unicode) and y (sticky) on and off with one tap. The pattern runs in a separate worker thread with a time limit, so a pattern with catastrophic backtracking such as (a+)+$ is stopped after 1.5 seconds instead of freezing the page. Your text never leaves the browser.

Regex Tester runs entirely in your browser. Your data is processed on your device and is never uploaded to Qiyi or anyone else.

How to use Regex Tester

  1. Type your pattern between the slashes in the Regular expression box, without the surrounding / characters.
  2. Toggle the flags g, i, m, s, u and y. Hover or long-press a flag to see what it does.
  3. Paste the text to search into Test string. Matches are highlighted and listed with their index and groups.
  4. Enter a replacement such as $1 or $<name> under Replace to preview the replaced text, then click Copy.
  5. Click any token in the cheat sheet to insert it into the pattern at the cursor.

Frequently asked questions

Which regex flavor does this tester use?

JavaScript (ECMAScript) regular expressions, evaluated by your browser's built-in RegExp engine. Syntax that only exists in PCRE, Python or .NET, such as possessive quantifiers, atomic groups, inline modifiers like (?i) or \A and \Z anchors, is reported as an invalid pattern.

Why does my regex only find one match?

Without the g (global) flag, JavaScript stops after the first match, just like RegExp.exec and String.replace do. Turn on g to find and replace every match. With the y (sticky) flag, matches must also start exactly where the previous one ended.

What does "took too long" mean?

Some patterns, typically nested quantifiers such as (a+)+ or (.*)*, can take exponential time on text that almost matches. This is called catastrophic backtracking. The tester runs the pattern in a background worker and stops it after 1.5 seconds. Rewrite the pattern so that each part of the text can only be matched one way, for example by removing the nested quantifier.

How do I use capture groups in the replacement?

Use $1, $2 and so on for numbered groups, $<name> for a named group (?<name>…), $& for the whole match, $` for the text before it, $' for the text after it and $$ for a literal dollar sign. These are the same rules as JavaScript's String.prototype.replace.

Do I need to escape slashes?

No. Enter the pattern as you would pass it to new RegExp(), without surrounding slashes, so / does not need escaping. Backslashes are written once, for example \d+ rather than "\\d+" as in a JavaScript string literal.

· Free · Runs in this browser · nothing is uploaded

Drop any file here
Drop it to see which tools can open it