Regex tester
Type a pattern and watch it match as you type. Every token is explained in plain English, and capture groups are listed underneath.
3 matches
Groups
Python output converts named groups to (?P<name>…) and flags to re. constants.
How to read a regular expression
A regex is a sequence of small instructions read left to right: match this character, then one of these, then repeat that. The explanation panel breaks your pattern into exactly those steps, and indents the steps inside a group so you can see its structure.
The three things that trip people up most: forgetting the g flag (only the first match is found), greedy quantifiers (.* swallows as much as it can; use .*?), and unescaped dots (. means any character; write \. for a literal dot).
The full syntax, with lookarounds, flags and common patterns, is on the regex cheat sheet.
Frequently asked questions
Which regex flavour does this tester use?
Your browser’s JavaScript (ECMAScript) engine, the same one used by Node.js and TypeScript. It supports lookbehind, named groups, the s (dotAll) flag and Unicode property escapes. Python’s re module is very similar; the main difference is named groups written as (?P<name>…).
Why does my pattern only find the first match?
Turn on the g (global) flag. Without it, JavaScript stops after the first match.
How do I use capture groups in the replacement?
Refer to numbered groups as $1, $2 and named groups as $<name>. $& inserts the whole match.
How can I test my regex?
Type the pattern in the box above, paste sample text that should and should not match, and check the highlighted matches and the groups table. Turn on g to see every match, and use the Replace field to preview substitutions before putting the pattern in code.
What does \s*,\s* do?
It matches a comma together with any whitespace around it: \s* means zero or more whitespace characters. Splitting "a , b,c" on it gives ["a", "b", "c"], which makes it a common way to split comma-separated lists.
Which regex tester should I use?
Use a tester that runs the same engine as your code. This one uses the JavaScript engine and can export the pattern to Python code with the syntax differences converted. For PCRE- or Go-specific features, test with that language’s own engine before shipping.
Is my text sent anywhere?
No. Matching runs locally as you type. Only if you use the “Describe it” AI box are your description and a short sample of the test text sent to the AI model.