UtilitiesTools

Regex Tester

Type a regular expression and some sample text to see every match highlighted live, with its numbered capture groups — no Run button, no sign-up, and nothing ever leaves your browser.

Flags

🔒 Run with your browser's native RegExp engine. Nothing is uploaded.

Highlighted matches 0 matches
Your highlighted text appears here.

What is the Regex Tester?

The Regex Tester is a free online tool for building and checking regular expressions against your own sample text. You type a pattern in one box and your test string in another, and every match is highlighted instantly while you type — no Run button, no sign-up, and nothing uploaded to a server. It is built for developers and anyone who needs to confirm that a regular expression matches exactly what they expect before pasting it into real code or a search-and-replace dialog.

How to use it

  1. Type or paste your regular expression into the pattern field (write it without the surrounding slashes, just the expression itself).
  2. Paste the text you want to test into the test-string field.
  3. Tick the flag checkboxes you need — g for all matches, i for case-insensitive, m for multiline, s for dotAll.
  4. Read the result: matches light up in the test string, and a panel lists each match with its numbered capture groups.

There is no submit step. The highlights and the group list update on every keystroke, so you get your answer in a second and move on.

The method behind it

The tester compiles your pattern and the selected flags into a native JavaScript RegExp object directly in your browser. It then runs the pattern over the test string, collecting each match along with its index and any parenthesised capture groups. Because it relies on the browser's own ECMAScript regex engine, the behaviour you see here is exactly what your JavaScript or Node.js code will do with the same pattern. If the pattern is syntactically invalid, the engine's error message is shown instead of an empty result, so you always know whether the problem is your pattern or your text.

Examples

Cheat sheet of common patterns

TokenMatches
.any character except newline (use the s flag to include newlines)
\d \w \sa digit, a word character, or whitespace
\D \W \Sthe negation of each: non-digit, non-word, non-space
^ $start and end (of string, or of each line with the m flag)
* + ?zero-or-more, one-or-more, optional
{n} {n,m}exactly n, or between n and m, repetitions
[abc] [^abc]any one of a/b/c, or any character except them
(…) (?:…)a numbered capture group, or a non-capturing group
a|balternation — match a or b
\. \(escape a literal dot, parenthesis, or other metacharacter

Common use cases

Why use this one

Unlike heavier playgrounds, this tester gives you live highlighting plus a clear capture-group breakdown with zero setup and zero login, and it runs entirely client-side so your pattern and data never leave your browser. A built-in cheat sheet of common metacharacters keeps you from opening a second tab. It is also fully mobile-friendly, so you can check a pattern on your phone.

It pairs naturally with the rest of our developer cluster: use the Text Diff Checker to compare the before-and-after results of a replace, the JSON Formatter to pretty-print data you extracted, and the Base64 Encode / Decode tool when your text needs encoding.

Frequently asked questions

Which regex flavor does this regex tester use?

It uses the native JavaScript RegExp engine that runs in your browser, so patterns follow ECMAScript regular-expression syntax. This matches what you would write in JavaScript, TypeScript, and Node.js. Most common syntax (character classes, quantifiers, groups, anchors) behaves the same as PCRE, but a few advanced constructs differ — see the cheat sheet for notes.

Does my regex pattern or test text get sent to a server?

No. The entire tool runs client-side using the browser's built-in RegExp engine. Your pattern and your sample text never leave your device, are never uploaded, and are not logged. You can even keep using it offline once the page has loaded.

What do the g, i, m, and s flags do?

g (global) finds every match instead of stopping at the first. i (ignore case) makes the pattern case-insensitive. m (multiline) makes the anchors match the start and end of each line rather than the whole string. s (dotAll) lets the dot also match newline characters. Toggle them as checkboxes and watch the highlights update.

How do I capture part of a match instead of the whole thing?

Wrap the part you want in parentheses to create a capture group. For example, a pattern with three parenthesised groups for year, month, and day captures each piece of a date separately. The tester lists every numbered group for each match so you can confirm your extraction logic before using it in code.

Why does my pattern show no matches even though it looks correct?

The two most common causes are a missing g flag, so only the first match is found, and unescaped special characters — a literal dot, plus, or parenthesis must be escaped with a backslash. If the pattern itself is invalid, the tester shows the syntax error message from the RegExp engine instead of failing silently.

Related tools