Free Regex Tester
Type a pattern and some text. Matches, capture groups and replacements update as you type, and nothing leaves your browser.
Enter a pattern to see matches.
This pattern took too long on this text, which usually means catastrophic backtracking. Look for nested quantifiers such as (a+)+.
Showing the first 1,000 matches.
| Index | Match | Groups |
|---|---|---|
What is a Regex Tester?
A regex tester runs a regular expression against sample text and shows you exactly what it matched, so you can fix a pattern before it reaches your code.
This one uses your browser's JavaScript engine, so the result is what the same pattern does in JavaScript. Patterns run in a separate worker with a one second limit, which means a runaway pattern stops instead of freezing the page.
- Enter your pattern without the surrounding slashes, and tick the flags you need.
- Paste the text to test. Matches are highlighted and listed with their capture groups.
- Add a replacement to preview the result, using $1 and $2 for capture groups.
Why Test a Regex First?
- See every match: a pattern that looks right often matches too much or too little, and highlighting shows it at once.
- Check the groups: the table lists what each capture group holds for every match.
- Private by design: logs and sample data are processed on your device and never sent to us.
Regex Cheat Sheet
The syntax that covers most everyday patterns.
| Kind | Syntax | What it does |
|---|---|---|
| Anchors | ^ $ \b | Match a position rather than a character: the start, the end, or a word boundary. |
| Character classes | [a-z] \d \w \s . | Match one character from a set. \d is a digit, \w a word character, \s whitespace, and the dot almost anything. |
| Quantifiers | * + ? {2,5} | Repeat what comes before. They are greedy by default; add ? to take as little as possible. |
| Groups | (x) (?:…) (?<name>x) | Capture part of a match, group without capturing, or give a capture a name. |
| Lookaround | (?=x) (?!x) (?<=x) | Require something before or after a match without including it in the match. |
| Flags | g i m s u | Change how the whole pattern behaves: find every match, ignore case, treat lines separately, let the dot cross lines, or read Unicode. |
How to Read the Result
Each panel answers a different question about your pattern.
What matched
HighlightMatched text is highlighted in place, so you can see at a glance what the pattern took and what it left behind.
Capture groups
TableEach row gives a match, the position where it starts, and the value of each capture group, in order.
After replacement
PreviewShows the full text after the replacement. Without the global flag, only the first match is replaced.
Stopped after one second
LimitA pattern that runs past one second is stopped. That usually points at catastrophic backtracking, and it would be just as slow in your application.
What a Regular Expression Is
A regular expression is a compact description of a text pattern. Engines use it to find, validate, extract and replace text, from a form field check to a search across millions of log lines.
Most patterns combine three ideas:
- Literals: characters that match themselves.
- Classes: sets of characters that could appear at a position.
- Quantifiers: how many times something may repeat.
Regex Flavors Differ
JavaScript, PCRE (used by PHP), Python and Go share most syntax and disagree on the edges. Lookbehind support, named group spelling and Unicode classes all vary, and Go's RE2 engine has no backreferences or lookaround at all.
This tester runs JavaScript. If your pattern will run elsewhere, test it there as well before you ship it.
Where Regex Trips People Up
A pattern that works on one sample can still fail in production. The usual causes:
- Greedy quantifiers: .* takes as much as it can, so a pattern for one HTML tag can run from the first tag to the last. Use .*? to stop early.
- Unescaped dots: a dot matches almost any character, so example.com also matches examplexcom. Write example\.com.
- Missing anchors: without ^ and $, a validation pattern passes when any part of the input matches, not all of it.
- Catastrophic backtracking: nested quantifiers such as (a+)+ can take exponential time on input that nearly matches, which turns user input into a denial of service.
- Building URLs from text? A slug generator is safer than a hand-written pattern, because it deals with accents and punctuation for you.
Why Testing a Pattern Matters
Quiet failures
A wrong regex rarely throws an error. It returns the wrong text, so the bug surfaces far from its cause.
Slow patterns
One bad quantifier can pin a CPU. A time limit makes that risk visible while the pattern is still on your screen.
Input validation
Too strict rejects real users and too loose lets bad data in. Testing both kinds of sample finds the line.
Log and data work
Extracting fields from logs depends on groups landing where you expect, and one test run shows whether they do.
Who Uses a Regex Tester
The same tool serves very different jobs.
Developers & IT
Build validation rules, parsers and log filters before they go into code or config.
For IT & MSPsSEO Teams
Write redirect rules and analytics filters that catch the right URLs and only those.
For SEO & publishersSecurity Teams
Tune detection rules and blocklists against real samples without sending them anywhere.
For brand protectionRelated Tools
More utilities, and the checks behind the names you run.
Generate URL slugs
Turn titles into clean URL paths without writing a pattern yourself.
Slug generatorMonitor your domains
Get an alert when a domain's expiry, DNS or certificate changes.
See domain monitoringFrequently Asked Questions
Common questions about testing regular expressions.
Which regex flavor does this use?
JavaScript, through your browser's own engine. Most syntax carries over to PCRE and Python, but check edge cases in the language you will run it in.
Is my text sent to a server?
No. The pattern and the text are processed in your browser, in a worker on your device. Nothing you type is sent to Domainyze.
Why did my pattern stop after one second?
It ran too long, usually because of catastrophic backtracking. The limit keeps the page responsive. Look for nested quantifiers and overlapping alternatives.
Do I need the slashes around the pattern?
No. Enter only the pattern, and choose flags with the checkboxes.
How do I use capture groups in a replacement?
Use $1, $2 and so on for numbered groups, $<name> for named groups, and $& for the whole match.
Why does only the first match show?
The global flag is off. Tick g to find every match.
What does the multiline flag do?
It makes ^ and $ match at the start and end of each line, rather than of the whole text.
Can a regex validate an email address?
Only loosely. A simple pattern catches typos, but the only real test of an address is sending mail to it.
Start Monitoring & Catching Domains Today
Join founders, agencies, and domainers already protecting their portfolio. Your first 5 domains are free.
No credit card required • Cancel anytime
Guides for domain operators
Deep dives on domain names, DNS, SSL, acquisitions and portfolio management.
All guides →
4 Letter Domains: The Complete LLLL Investing Playbook
4 letter domain names represent one of the most liquid segments of the domain aftermarket. All 456,976 possible .com combinations are registered.
.SI Domain: Slovenia's 30-Year-Old ccTLD Is Suddenly Super Intelligence
What is the .SI domain? Learn how Slovenia's country-code TLD went from 10 registrations in 1992 to a 2,199% surge in September 2026, and why 'super intelligence' made .SI the new .AI.
Infringing Domains: Detecting, Monitoring, and Recovering
Your domain is your storefront. Every day, someone registers a lookalike of it, to skim your traffic, phish your customers, or hold it for ransom. This guide covers what infringing domains are, how to find them before they hurt you, and exactly what to do when you do.