Code · Made a little simpler

JavaScript Regex Tester

Test a JavaScript regular expression on your device. Highlight matches, inspect captures and UTF-16 offsets, explore a pattern tree and export JSON.

Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device

Enter the pattern without slash delimiters. Use g for all matches, i for case-insensitive matching and d for capture positions.

Add this tool to your website

Paste this code into your page to add the tool and a visible ToolMellow credit link.

HTML embed code
Preview embed

JavaScript Regex Tester: how to use it

  1. Enter the pattern body without slash delimiters and enter JavaScript flags separately.
  2. Paste test text and select Test pattern. Inspect highlighted matches and expand the pattern tree.
  3. Read the indexed and named groups. Include d in the flags for capture positions and download the match report as JSON.

Limits and notes

Runs in a cancellable worker with a three-second limit. Accepts 4,096 pattern and 100,000 subject UTF-16 units. Reports stop at 500 matches or a capture budget. Browser support determines available flags.

How your privacy works →

JavaScript Regex Tester: common questions

Why does an emoji occupy two positions?

JavaScript offsets count UTF-16 code units. With u, a dot can match an entire supplementary character while the reported end position still advances by two.

What does a null capture mean?

A group that did not participate has a null entry in the JSON report. A group that matched an empty string has the value "" and may have equal start and end offsets.

Guides