Skip to content

Developer Tools

Regex Tester

Test regular expressions with live highlighting and capture groups.

regex testerRuns in your browserUpdated 2026-09-22

Pattern

3 matches
//gi
Flags
Common patterns

Replacement preview

uses $1, $2 and $&
Contact ada [at] example.com or grace [at] navy.mil about the release.
Fallback address: ops [at] tlks.io.

Test text

91 chars

Highlighted matches

Contact ada@example.com or grace@navy.mil about the release.
Fallback address: ops@tlks.io. 

Match details (3)

  1. ada@example.comindex 8
    • $1 = ada
    • $2 = example.com
  2. grace@navy.milindex 27
    • $1 = grace
    • $2 = navy.mil
  3. ops@tlks.ioindex 79
    • $1 = ops
    • $2 = tlks.io

About Regex Tester

Regular expressions are compact, expressive and easy to get subtly wrong. Testing a pattern against realistic input before shipping it is far cheaper than discovering the mistake in production, where it might silently match too much or nothing at all.

This tester evaluates your pattern as you type, highlights every match in the sample text, and lists the capture groups for each match. The replace mode shows what a substitution would produce, which is the quickest way to verify an anchor or a greedy quantifier.

How it works

  • The pattern is compiled with the JavaScript regular expression engine and your chosen flags.
  • All matches are found with the global flag and highlighted in the sample text.
  • Each match is listed with its index and its numbered and named capture groups.
  • Replace mode applies your replacement string, including $1 style backreferences.
  • Common patterns such as email, URL, IPv4 and ISO date are included as starting points.
  • Invalid patterns produce a compile error instead of an empty result.

Input and output

Accepts

A regular expression, flags, sample text and an optional replacement string.

Produces

Highlighted matches, match and group listings, and the replaced text.

Privacy

Matching runs in your browser with the built-in RegExp engine, so test data stays local.

Regex Tester FAQ

Why does my regex match only the first occurrence?

Without the global flag, a regular expression stops after the first match. In this tester the global flag is enabled by default.

What is catastrophic backtracking?

Nested quantifiers such as (a+)+ can make the engine explore an exponential number of paths on non-matching input. Rewrite the pattern to be more specific, for example (a+), and test with long inputs.

Is JavaScript regex syntax the same as in Python or Go?

Mostly, but not exactly. Lookbehind, named group syntax and Unicode property escapes differ between engines. Always re-test a pattern in the language that will run it.

How do I test multi-line text?

Enable the m flag so ^ and $ match at line boundaries, and the s flag if a dot should also match newlines.