Regular Expression Tester
Test regular expressions live. See match groups, named captures, indices and flags, try the replacement preview, and get an explanation of what each part of the pattern does.
Free, no sign-upRuns in your browserNothing uploaded
Matches highlighted in place
ada@example.com, grace.hopper+dev@example.comMatches (2)
0: ada@example.com
0: grace.hopper+dev@example.com
What this pattern does
[ ]Character class: matches any single character in the set. A leading ^ negates it.\wA word character: letter, digit or underscore.*Greedy quantifier: match as much as possible, then give back.{n,m}Bounded repetition: an exact number or range of repeats.
Paste a pattern and a test string and you see every match immediately, highlighted in place, with the full and partial match broken out. Group 0 is the whole match, and every numbered and named group is listed with its own captured value and character offsets, which is the fastest way to find out why a group is coming back undefined.
Flags are toggles rather than text to remember: global, case-insensitive, multiline, dot-all, sticky, unicode and unicode-sets. The tool tells you when a flag is unavailable in your browser rather than silently ignoring it, since the last two are recent and a pattern written against a modern engine can fail in an older one.
The pattern is also explained. Each part is annotated in plain English - a word boundary, a lazy quantifier, a back-reference, a lookahead - so a pattern you copied from a forum becomes readable. That matters more than it sounds: most regex debugging is really just working out what someone else's pattern was supposed to do.
Regex Tester features
How to use the Regex Tester
Write your pattern
Type into the pattern field. The live indicator shows whether it compiles, and gives the exact syntax error and position if it does not.
Paste a test string
Multi-line input works, and the multiline flag changes how ^ and $ behave. The match count and total matched characters are shown.
Inspect the groups
Each capture group is listed with its value and start and end offsets, named groups by name. A group with no value is called out, which is usually the bug you are hunting.
Preview the replacement
Enter a replacement string using $1, $2 and named captures to see the result before you put it in production code.
Frequently asked questions
Why is my group undefined?
What is the difference between a greedy and a lazy quantifier?
Why does my regex hang on certain inputs?
Should I use lookahead for validation?
Are the results the same across JavaScript, Python and Java?
Is the regex executed on a server?
Related tools
Every tool, in one place
ToolForge has regex tester plus a growing set of image, colour and developer tools. All of them run locally in your browser, free and without an account.
Browse all tools