Regex Tester

Test regular expressions live: highlighted matches, groups per match, flags with one click and a replace preview. Does not freeze on costly patterns.

Flags
Matches in the text

Matches0

#PositionMatchGroups
Regex syntax cheat sheet
.any character except line break
\d \w \sdigit, word character, whitespace
\D \W \Sthe opposite
[abc] [^abc]one of the characters, none of them
^ $start, end (per line with m)
\bword boundary
* + ?0 or more, 1 or more, 0 or 1
{2} {2,5}exactly 2, 2 to 5 times
*? +?as few as possible (lazy)
(abc)group, $1 when replacing
(?<name>abc)named group, $<name> when replacing
(?:abc)non-capturing group
a|ba or b
(?=a) (?!a)followed by a, not followed by a
\p{L}any letter including accents (with u flag)

Frequently asked questions

Which regex flavor is used?

The JavaScript (ECMAScript) flavor used in browsers and Node.js. Matches are highlighted directly in the text.

How does this tool work?

Tests regular expressions in JavaScript syntax against your own text.

Enter an expression and tick flags such as g, i, m, s, u or y. Matches are highlighted in the text as you type and listed in a table with position and all groups, named groups with their name. In the replace field you see right away what the text looks like after replacing with $1 or $<name>. Syntax errors are reported immediately. A cheat sheet explains the most important tokens. One click copies the expression as a JavaScript literal.

Where are my data processed?

Only in your browser. Your data is not sent to any server.

The tool calculates and converts with JavaScript right on your device. Input and files are not sent to us or anyone else. You can check this yourself: load the page, disconnect from the internet, and the tool keeps working in the open tab.

No Server UploadNo sign-upRuns Offline in Tab

How it works and how to check it