Skip to content

Regex Tester

Test regular expressions live with match highlighting, capture group tables, and replace preview. Includes a cheatsheet of common patterns. 100% in-browser.

//
Test string

What is a Regex Tester?

A regex tester (regular expression tester) lets you write and debug regular expressions against real input without writing code. You see matches highlighted live as you type the pattern, making it easy to refine your expression until it matches exactly what you intend — and nothing it shouldn't.

This tester uses the JavaScript regex engine built into your browser, supporting modern ES2018+ features: named capture groups, lookbehind assertions, dotall mode (s flag), and Unicode mode (u flag).

How to use this Regex Tester

  1. Enter your regular expression in the pattern bar. The /slashes/ are decorative — just type the pattern.
  2. Toggle flags (g, i, m, s, u) using the buttons to the right of the pattern bar.
  3. Paste your test string below. Matches are highlighted in real time with colour-coded spans.
  4. Expand Capture groups to see a table of all group matches by name or index.
  5. Expand Replace preview to test a replacement string with backreferences ($1, $<name>).
  6. Load a pattern from the Cheatsheet as a starting point, then customise it.

Regex flag reference

g
Global — find all matches, not just the first.
i
Case-insensitive — Hello matches hello.
m
Multiline — ^ and $ match line start/end.
s
Dotall — . matches newline characters too.
u
Unicode — enables full Unicode matching and escapes.

Why test regex in the browser privately?

Log lines, error messages, and test data you paste into a regex tester often contain sensitive details: user IDs, IP addresses, API responses, PII from support tickets. This tester runs entirely client-side — your test strings are never sent to any server. The pattern URL-sharing feature uses LZ-string compression in the URL hash (not the query string), keeping the canonical URL clean for bookmarking and sharing.

Frequently Asked Questions

How do I test a regular expression online?

Enter your regex pattern, select flags (g, i, m, s, u), and paste your test string. Matches are highlighted in real time.

How do I see capture groups?

The capture groups table below the test string shows every match with its named and numbered groups.

Can I preview a regex replace?

Yes. Enter a replacement string (with $1 backreferences) and see the result instantly.

What regex flavors are supported?

JavaScript regex (the built-in browser engine), which supports ES2018+ features like named groups and lookbehind.