Regex Tester
This free regex tester runs your regular expression against your text live, highlighting every match and its capture groups as you type. It explains your pattern piece by piece in plain English, previews find and replace, and comes with a built-in cheat sheet and ready-made patterns for email, URLs, dates and more.
| @8 | hello@aeontoolhub.com | $1=hello $2=aeontoolhub.com |
| @33 | sales@example.com | $1=sales $2=example.com |
- (start of a capturing group (saves what it matches)
- \wany word character (letter, digit or underscore)
- +one or more times
- )end of the group
- @the literal character "@"
- (start of a capturing group (saves what it matches)
- \wany word character (letter, digit or underscore)
- +one or more times
- \.a literal "." (escaped)
- \wany word character (letter, digit or underscore)
- +one or more times
- )end of the group
What does this regex tester do?
It runs your regular expression against your text live and shows you three things most testers make you hunt for: what matched, what each part of your pattern means, and what a find-and-replace would produce.
- Live match highlighting as you type, with every capture group listed.
- A plain-English explanation that breaks your pattern into pieces and labels each one.
- Replace preview so you can see find-and-replace before running it in code.
- A built-in cheat sheet and ready-made patterns for email, URLs, IPv4, dates, hex colours and more.
- A share link that reopens your exact pattern, flags, text and replacement.
Everything runs in your browser on the native regex engine. Nothing you type is uploaded.
How do I use it?
Write the pattern in the top field. The slashes and the flag list around it show you the full expression, exactly as you would write it in code.
Toggle the flags you need with the buttons. Hover any of them for a one-line reminder.
Paste your text below. Matches highlight instantly and the capture groups appear underneath.
Read the explanation to see what each token does. This is the part that turns "it doesn't work and I don't know why" into "ah, that quantifier is greedy."
Replace or share when you are done: preview a find-and-replace, or copy a link that reopens the whole thing for a teammate.
Which regex flavour is this, and why it matters
This is a JavaScript regex tester. It runs your pattern on the browser's own engine, which is the same engine your JavaScript and Node code will use, so what you see here is what you get there.
We are deliberate about this. Tools that claim to test Python, PCRE, Go and .NET usually run those engines on a server. Running them in your browser would mean shipping a heavy engine that would slow the page down, and speed is not something we trade away. So this tester is honest about being JavaScript rather than pretending to be seven languages it cannot actually run.
Most regex syntax is shared across languages, but a few things differ, and they are the ones that bite:
- Lookbehind
(?<=...)is supported in modern JavaScript but was missing for years and still varies elsewhere. - Named groups use
(?<name>...)in JavaScript and Python, but(?P<name>...)in older Python. - Escaping rules for things like
\dinside character classes differ subtly between engines.
If your target is Python or PHP, use this to get the logic right, then check the flavour-specific syntax in that language's docs.
Greedy vs lazy, the mistake everyone makes
A quantifier like * or + is greedy by default: it matches as much as it possibly can, then hands characters back only if the rest of the pattern would otherwise fail.
Take <.*> against <a> <b>. You might expect it to match <a>, but greedy .* grabs everything up to the last >, so it matches <a> <b> in one go. Add a question mark to make it lazy, <.*?>, and it stops at the first >, matching <a> and <b> separately.
This single distinction is behind a huge share of "my regex matches too much" problems. The explanation panel labels lazy quantifiers explicitly so you can see which behaviour you are getting.
What are capture groups for?
A capture group is parentheses around part of your pattern that saves what it matched, so you can reuse it.
- Numbered:
(\d{4})-(\d{2})captures the year as$1and the month as$2. - Named:
(?<year>\d{4})captures the same thing as$<year>, which is easier to read in a long pattern. - Non-capturing:
(?:...)groups for precedence without saving, which keeps your group numbers clean.
In replace mode you reference these as $1 or $<year> to rearrange and reformat text. Reversing First Last to Last, First is just (\w+) (\w+) replaced with $2, $1.
What this tool does not do
- It does not run Python, PCRE, Go or .NET. It is a JavaScript engine, stated plainly. Use it for the logic, then confirm flavour-specific syntax in your language.
- It does not save a personal library of your patterns. There is no account. Use the share link or copy the pattern to keep it.
- It does not generate a regex from a description. You write the pattern; the tool tests and explains it. It is a tester, not an AI generator.
- It does not validate that a pattern is "correct" for your data. A regex that matches your sample can still miss edge cases. Always test against your real inputs.
- The ready-made patterns are starting points, not law. No single regex perfectly validates every real email or URL. Adapt them to your case.
Is my data private?
Yes. The tester runs entirely client-side on the native regex engine. Your pattern and test string are never uploaded, logged, or stored, and they clear when you close the tab. Even the share link carries the data in the address rather than on a server, and the page keeps working offline once it has loaded.
Frequently asked questions
How do I test a regular expression?
Type your pattern in the top field and paste your text below it. Matches highlight live as you type, with capture groups listed underneath. Turn flags on and off with the buttons, and read the explanation panel to see exactly what each part of your pattern is doing. Nothing is uploaded.
Which regex flavor does this use?
JavaScript, run by your own browser engine, so what you see here is exactly what runs in Node and in the browser. It is honest about that rather than pretending to support Python or PCRE, which cannot run client-side without a heavy download. Most syntax is shared, but a few things like lookbehind support differ between languages.
What do the flags g, i, m, s, u and y mean?
g finds all matches instead of just the first; i ignores case; m makes the anchors match at each line break; s lets the dot match newlines; u reads the pattern as Unicode code points; y matches only from the last position. Hover any flag button to see a short reminder of what it does.
How do capture groups work?
Wrap part of a pattern in parentheses to save what it matches, available as $1, $2 and so on. Use (?<name>...) for a named group you can reference as $<name>. This tester lists every group for each match, and you can use those references in the replace field to rearrange or reformat the matched text.
Can I use it to find and replace text?
Yes. Tick replace mode and type a replacement, using $1 or $<name> to insert captured groups. The result updates live so you see exactly what your pattern would produce. Without the g flag only the first match is replaced, which mirrors how the replace works in real code, so there are no surprises.
Why does my pattern match nothing, or too much?
Two classic traps. Forgetting the g flag stops it finding matches after the first, and greedy quantifiers like .* grab as much as possible when you often want the lazy .*? instead. The explanation panel is there for exactly this: it breaks the pattern down so you can see where it is doing something you did not intend.
What is the difference between greedy and lazy?
A greedy quantifier such as + or * matches as much text as it can, then gives characters back only if the rest of the pattern fails. Adding a question mark makes it lazy, matching as little as possible. So .* grabs a whole line while .*? stops at the first chance. This tester labels lazy quantifiers in the explanation.
Can I share a regex with someone?
Yes. The copy share link button puts your pattern, flags, test string and replacement into the address itself, so the link opens with everything loaded and nothing is stored on any server. Send it to a teammate or paste it into a bug report and they see exactly the pattern and case you were working on.
Are the ready-made patterns production-ready?
They are solid starting points for common cases like email, URLs, IPv4 and dates, and each loads with a sample so you can see it work. But no single regex validates every real-world email or URL perfectly, so treat them as a base to adapt, and always test against your own data before relying on one.
Is anything I type sent to a server?
No. The tester runs entirely in your browser using the native regex engine. Your pattern and text are never uploaded, logged, or stored, and they clear when you close the tab. Even the share link holds the data in the address rather than on a server, and the tool works offline once loaded.
Related tools
DeveloperJSON FormatterFormat, beautify, and validate JSON right in your browser.
DeveloperSlugifyTurn any text into a clean URL slug, one or a whole list.- DeveloperText Diff CheckerCompare two texts and see exactly which words changed.
DeveloperToken CounterCount tokens exactly, check the context window, estimate the cost.
DeveloperBase64 Encoder / DecoderEncode text, images and files to Base64, and decode them back.
Last updated: September 18, 2026