Free Regex Tester

Type a pattern and some text. Matches, capture groups and replacements update as you type, and nothing leaves your browser.

Updates
As you type
Your text
Stays in your browser

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.

How to test a regex
  1. Enter your pattern without the surrounding slashes, and tick the flags you need.
  2. Paste the text to test. Matches are highlighted and listed with their capture groups.
  3. 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

Highlight

Matched text is highlighted in place, so you can see at a glance what the pattern took and what it left behind.

Capture groups

Table

Each row gives a match, the position where it starts, and the value of each capture group, in order.

After replacement

Preview

Shows the full text after the replacement. Without the global flag, only the first match is replaced.

Stopped after one second

Limit

A 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

01

Quiet failures

A wrong regex rarely throws an error. It returns the wrong text, so the bug surfaces far from its cause.

02

Slow patterns

One bad quantifier can pin a CPU. A time limit makes that risk visible while the pattern is still on your screen.

03

Input validation

Too strict rejects real users and too loose lets bad data in. Testing both kinds of sample finds the line.

04

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 & MSPs

SEO Teams

Write redirect rules and analytics filters that catch the right URLs and only those.

For SEO & publishers

Agencies

Check redirect maps and form rules across client sites before launch day.

For agencies

Security Teams

Tune detection rules and blocklists against real samples without sending them anywhere.

For brand protection

Related Tools

More utilities, and the checks behind the names you run.

01

Generate URL slugs

Turn titles into clean URL paths without writing a pattern yourself.

Slug generator
02

Read TXT records

See every TXT record at a name, labelled by purpose.

TXT record lookup
03

Look up DNS

Read the live records for any domain.

Run a DNS lookup
04

Monitor your domains

Get an alert when a domain's expiry, DNS or certificate changes.

See domain monitoring

Frequently 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 Today

Start Monitoring & Catching Domains Today

Join founders, agencies, and domainers already protecting their portfolio. Your first 5 domains are free.

Create Free Account

No credit card required • Cancel anytime