Regex Tester & Explainer

Test regular expressions against sample text with live match highlighting, and get a plain-English breakdown of what the pattern actually does.

How to use the Regex Tester & Explainer

  1. Type a pattern into the Pattern box, and check any flags you need (g, i, m, s, u, y).
  2. Type or paste sample text into the Test string box — matches are highlighted immediately, with a full match list (index and captured groups) in the Matches tab.
  3. Switch to the Breakdown tab to read a plain-English explanation of each part of your pattern, indented to show group nesting.
  4. Switch to the Replace tab to preview a substitution using $1, $2, or $<name> group references.
  5. Use a preset button to load a ready-made pattern (email, URL, IPv4, hex color, phone number, ISO date) with sample text.
  6. Click Cheat sheet any time for a quick reference to common tokens, shown in a dialog you can close with the × button, the Escape key, or by clicking outside it.
  7. Copy the page URL to share or bookmark the exact pattern, flags, and test string you're working with.

How This Tool Works

Type a pattern into the Pattern box and toggle the flags you want (g, i, m, s, u, y) — matches against the Test string box update live as you type, with no delay, so you can watch how each keystroke changes the result. Matched text is highlighted inline, and every match is also listed below with its index and captured groups.

The Pattern breakdown panel parses your pattern into its structural parts — anchors, character classes, quantifiers, groups, lookaround, backreferences, and alternation — and explains each one in plain English, indented to show nesting. It updates from the same pattern you're testing, so it always reflects exactly what you typed.

Switch to Replace mode to preview a substitution: type a replacement string using $1, $2, or $<name> to reference captured groups, and see the result immediately. Presets load a ready-made pattern (email, URL, IPv4 address, hex color, phone number, ISO date) with sample text so you have something to experiment with right away, and the cheat sheet is always one click away if you forget a token's meaning.

Everything runs in your browser using JavaScript's native RegExp engine — nothing is uploaded, so it's safe to test patterns against real data. The current pattern, flags, test string, mode, and replacement are all saved into the page URL as you work, so you can copy the link to share or bookmark exactly what you were testing.

Frequently Asked Questions

Advertisement

Related tools

Advertisement