Regex Tester

Text /regex

Test ECMAScript regular expressions locally with flags, match results, capture groups, and replace preview.

Transfer
Local only
Limit
1 MiB test text
Results update as you edit the pattern, flags, and text.
Replace preview
<JSON> formatter
<json> validator
Matches
Match 1 · 0-4
JSON
Groups: JSON

Match 2 · 15-19
json
Groups: json
2 matches found. 2 lines 29 B local only

How it works

Test ECMAScript regex patterns with flags, capture groups, and replace preview.

Use it to test an ECMAScript pattern against sample text before adding it to code.

Example

Test (json) with gi flags against two lines and inspect both matches and replacement output.

Notes

  • This tool uses standard JavaScript RegExp behavior.
  • Replace preview follows normal JS replacement semantics.
  • Invalid patterns fail inline without changing your source text.

Constraints

  • Uses ECMAScript RegExp syntax and runs synchronously in the current browser tab.
  • Limit: 1 MiB test text. Nothing is uploaded or silently truncated.

Common errors

  • Unclosed groups or classes
  • Duplicate flags
  • Unexpected global-match behavior

When to use it

Use it to test an ECMAScript pattern against sample text before adding it to code.

Formats: ECMAScript pattern, JavaScript flags, Replacement string.

Reference

ECMAScript RegExp specification

Substantively reviewed .