Regex Tester

Enter a regular expression and test string below. Matches are highlighted in real time. Supports JavaScript regex flags. All processing happens locally in your browser.

/ / g
Copied!
#AtMatchGroups

Regular Expression Flags

FlagDescription
gGlobal - find all matches, not just the first
iCase-insensitive matching
mMultiline - ^ and $ match line boundaries
sDotall - . matches newlines
uUnicode - enable full Unicode matching
yMatch only at the position where the last one ended

Matches are listed with the position they start at and every group they captured, named groups included, which is usually the thing you are actually checking. Replace mode runs the same pattern through the standard replacement syntax, so $1 and $ behave exactly as they will in your own code. The number of matches is capped, because a pattern that matches at every position will otherwise build a table with more rows than the page can draw.

Reshaping data by hand again?

A payload you have to fix in a browser tab every time is a job for code. We build the integrations, parsers and services that move data between systems, and we repair the ones that quietly corrupt it on the way through.

Tell us what you are moving

Frequently Asked Questions

Why does my pattern only find the first match?
Because the g flag is off. Without it a regular expression stops at the first match by design, which is what you want in a validity check and not what you want when scanning a document. Turn it on and every match is listed.
Does it support named groups?
Yes. Both numbered and named groups appear in the table for every match, so a pattern using (?<year>\d{4}) shows the year alongside group 1. That is usually the thing you are checking, rather than whether the pattern matches at all.
How does replace mode handle $1?
Exactly as your own code will, because it hands the pattern and the replacement to the language's own replace. So $1 and $<name> refer to the groups, $& is the whole match and $$ is a literal dollar sign.
Why did it stop listing matches?
There is a cap, because a pattern that matches at every position produces one row per character and the table becomes unusable long before it becomes useful. When you hit it, the pattern is usually broader than intended.
My pattern makes the page hang. Why?
Some patterns backtrack catastrophically: nested quantifiers like (a+)+ can take exponential time on a subject that nearly matches. That is a property of the pattern rather than of this page, and it is worth knowing about, because the same pattern will do the same thing on your server.