Regex Tester

Runs entirely in your browser

Test a regular expression against sample text, with live match highlighting and capture groups.

Advertisement

0 Matches
Advertisement

What is Regex Tester?

Regex Tester runs a JavaScript regular expression against sample text and shows you every match, highlighted in place, along with any capture groups. It's useful for building and debugging patterns for validation, parsing or search-and-replace.

How to use Regex Tester

  1. Type your regular expression pattern.
  2. Choose the flags you need (g, i, m, s, u, y).
  3. Paste or edit the test string and review the highlighted matches and capture groups.

Features

  • Live matching as you type — no button to click.
  • Supports all six JavaScript regex flags.
  • Highlights every match directly in the test string.
  • Lists numbered and named capture groups per match.
  • Clear error messages for invalid patterns.
  • 100% client-side — your text never leaves your browser.

Example

Using the named-group pattern (?<user>\w+)@(?<domain>\w+\.\w+) with the g flag against the text Contact us at hello@toolbeel.com or support@example.org for help. produces 2 matches:

  • Match 1: "hello@toolbeel.com" — user: "hello", domain: "toolbeel.com"
  • Match 2: "support@example.org" — user: "support", domain: "example.org"

Each match is highlighted directly in the test string, and the named groups appear underneath it exactly as captured — no separate parsing step needed.

Tips

  • Named capture groups use the (?<name>...) syntax and show up by name in the match details, alongside the numbered groups.
  • The y (sticky) flag only matches starting exactly at lastIndex, unlike g (global), which scans forward through the string looking for the next match — swapping g for y can turn a pattern that matched everywhere into one that matches nothing.
  • Lookbehind assertions ((?<=...) and (?<!...)) work in current Chrome, Firefox and Edge, but only landed in Safari 16.4 (March 2023) — a pattern using them may silently fail to match in older Safari versions on iPhones and Macs still running earlier releases.
  • Matching is capped at 10,000 results specifically to protect against patterns that can match a zero-width string repeatedly (like a*) — if you see a capped count, your pattern is likely matching more often than intended.

Is Regex Tester safe?

Yes. Regex Tester matches your pattern against your text using JavaScript's native RegExp engine, running entirely in your browser — including the 10,000-match cap that guards against runaway zero-width-match patterns — so nothing you test is ever sent to a server.

Frequently Asked Questions

Which regex flags are supported?

g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode) and y (sticky) — the full set supported by JavaScript's RegExp.

Can a bad regex freeze the page?

No. Matching is capped at 10,000 iterations, which protects against runaway zero-width-match loops while comfortably covering realistic test strings.

Does this show capture groups?

Yes. Each match lists its numbered capture groups (and named groups, if your pattern uses them) alongside the full match.

Related tools