Regex Tester

//g
Flags:
Presets:
No match

Regex Tester

Use this tool to test JavaScript regular expressions against a sample string. It highlights matches in the test text and lists match details, including capture groups and named groups when the pattern produces them.

The pattern input expects the pattern body without surrounding slashes. The UI shows the selected flags next to the pattern.

Common Use Cases

Checking a Pattern Before Adding It to Code

Try a pattern with realistic sample text and confirm where each match starts.

Inspecting Capture Groups

Use match details to see numbered or named groups returned by JavaScript RegExp.

Starting from a Preset

Use presets such as email, URL, IPv4, ISO date, hex color, or Japanese phone number as editable starting points.

How to Use

  1. Enter a JavaScript regex pattern in the pattern field.
  2. Turn on the flags you need: g, i, m, or s.
  3. Paste or edit the test string.
  4. Review the highlighted matches and the match details below the input.
  5. Use a preset if you want a starting pattern to edit.

Notes / Limitations

Regex syntax differs by engine. This tool uses JavaScript RegExp, not PCRE, Python, Ruby, or database-specific regex syntax.

  • The UI exposes g, i, m, and s flags.
  • With the g flag enabled, the matcher lists up to 100 matches to avoid runaway output.
  • Presets are examples for quick testing, not full validation rules for every real-world value.
  • Invalid regex syntax is shown as an error from the JavaScript regex engine.

Privacy & Processing

Pattern testing runs in the browser with JavaScript. The regex tester code does not send your pattern or test string to a server.