Regex Tester

Test a regular expression against sample text with live match highlighting.

Developer Runs in your browser Shareable link
Pattern
Test text Never included in a share link
Matches

No matches yet

Type a pattern and some test text. Matching happens as you type, and is time-boxed so a runaway pattern cannot freeze the page.

Runs entirely in your browser. Your data isn't uploaded — this page makes no network request with anything you type, which you can verify in your browser's network tab. How this works.

What is the Regex Tester?

Regular expressions are written by trial and error, so the speed of the feedback loop determines how good the result is. Seeing which parts of your sample text match, and what each capture group contains, turns guesswork into something closer to debugging.

This tester runs JavaScript regular expressions — the flavour used in Node, browsers and many config formats — highlights every match live as you type, lists numbered and named groups, previews replacements, and breaks the pattern down token by token in plain English.

How to use it

  1. Type your pattern in the pattern field and set the flags you need (g, i, m, s, u).
  2. Paste sample text — ideally including cases that should not match.
  3. Matches highlight as you type; hover or click one to see its capture groups.
  4. Use the Replace tab to preview a replacement string with $1 and $<name> references.

Example

A pattern with a named group, tested against sample log lines.

Input
pattern: ^(?<level>WARN|ERROR)\s+(?<msg>.+)$    flags: gm
Result
match 1  level=WARN   msg=disk 82% full
match 2  level=ERROR  msg=upstream timeout

2 matches, 2 named groups

Features

  • Live match highlighting as you type
  • Numbered and named capture group tables per match
  • Replacement preview with backreference support
  • Token-by-token explanation of the pattern
  • Flag toggles with an explanation of each
  • Catastrophic backtracking guard so a runaway pattern cannot hang the page
  • Shareable link containing the pattern and flags (never the test text)

Frequently asked questions

Which regex flavour is this?
ECMAScript (JavaScript), including named groups, lookbehind and Unicode property escapes in modern browsers. PCRE, Python, Go RE2 and Java differ in places — notably RE2 has no backreferences or lookaround at all.
Why does my pattern only find the first match?
You need the g (global) flag. Without it, matching stops after the first result.
What is catastrophic backtracking?
Nested quantifiers such as (a+)+ can make the engine explore exponentially many paths on a non-matching input, freezing whatever is running it. Matching here is time-boxed and the tool warns you when your pattern has that shape — worth fixing before it reaches production.
Is my test text shared when I use the share link?
No. Only the pattern and flags are encoded in the URL, because test data often contains real values.
Esc

Loading the catalog…