Regex Tester

Type a regular expression and some sample text to see every match highlighted instantly, along with the match count and any capture groups. It uses your browser's native regex engine, so nothing you enter is uploaded.

Enter a pattern and some text to see matches.

How the regex tester works

A regular expression (regex) is a pattern that describes a set of strings. This tool compiles your pattern with the browser's native RegExp engine and runs it against your test text, so the rules it follows are exactly the JavaScript flavor of regex — the same one that runs in every web app.

new RegExp(pattern, flags) match against text highlight

Every match is highlighted in place. With the global flag g, all matches are found; without it, only the first. Capture groups in parentheses ( ) are reported separately so you can see exactly what each group captured.

Worked example

The pattern \b\w+@\w+\.\w+\b with flags gi finds email-like tokens:

\b\w+ matches a word before the @.
@\w+\.\w+ matches the @ host and a dotted suffix.
Result: [email protected] and [email protected] match; plain words don't.

Flags and tips

Flags change how matching behaves: g finds every match, i is case-insensitive, m makes ^ and $ match line starts/ends, s lets . match newlines, and u enables full Unicode. Remember to escape special characters (. * + ? ( ) [ ] { } ^ $ | \) with a backslash when you mean them literally.

Tip: need to clean up text instead of just matching it? Try the case converter or text diff checker.

Frequently asked questions

Which regex flavor does this use?

It uses the JavaScript (ECMAScript) regular-expression engine built into your browser. That's the same flavor used in front-end and Node.js code, so patterns behave identically to your app.

What do the flags mean?

g = find all matches, i = ignore case, m = multiline (^ and $ match each line), s = dotall (. matches newlines), u = full Unicode. Combine them with no spaces, e.g. 'gim'.

Why is my pattern invalid?

Usually an unbalanced bracket or parenthesis, or an unescaped special character. The tester shows the browser's error message so you can see exactly what went wrong.

Is my text sent anywhere?

No. The pattern and text are compiled and matched by your browser's own regex engine on your device. Nothing is uploaded, so it's safe for private data.

MB
Mustafa Bilgic · Editor, Calcool
Matching uses the browser's native JavaScript RegExp engine (ECMAScript flavor). Everything runs in your browser — nothing you enter is uploaded, logged or stored.

Related calculators