ExtraTools/code

REGEX SANDBOX & EXPLAINER

REGULAR EXPRESSION TESTER

Test and understand regular expressions

Build and debug regex patterns while matches are highlighted in your test text. Inspect numbered and named capture groups, preview replacements, and review common syntax.

JavaScript RegExp runs in your browser. Optional PHP PCRE sends only the current pattern and sample text to this site for testing; it is not saved.

Full mode is active — capture groups, replacement, and explanation are available.

Pattern, flags, and test text

JavaScript · local
Regex engine

Runs locally in a Web Worker. A time limit keeps a slow pattern from freezing the page.

gu
Flags

Global matching is used for the result list. The g flag controls whether replacement changes one match or all matches.

Templates are practical starting points, not complete validators for every standard or edge case.

0

Edit the pattern or test text to update the results.

Enter a pattern to start testing.

Replacement preview

Supports $0, $1, $2, $&, $$, ${name}, and $<name>. $0 and $& insert the full match. In either engine, the g flag controls whether one match or all matches are replaced.

Regex explainer

A best-effort description of common regular-expression syntax.

Enter a pattern to see its syntax breakdown.

Capture group inspector

0
Match #GroupNameCaptured valueIndex

This pattern has no capture groups.

Regex Sandbox features

Create and debug regular expressions for JavaScript or PHP without external services. The tool handles Cyrillic and English text and shows matches directly in the sample.

  • Live highlighting of matches in Russian, English, and mixed text.
  • Capture group table with group numbers, names, matched text, and positions.
  • Substitution preview with numbered and named references.
  • Plain-language explanation for common anchors, groups, escapes, character classes, and quantifiers.
  • One-click starter patterns for email, URLs, dates, phones, IP addresses, UUIDs, password rules, and HTML tags.
  • No external libraries or services. JavaScript mode stays in your browser; PHP PCRE sends only the current test request to this site and stores no text.

How to use the regex tester

Enter a pattern, choose flags, and type or paste test text. Matches update as you edit. Select a ready-made pattern to start from a common example.

Could not test this regular expression