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.
Read a regex tree and its capture offsets
Enter the pattern without slash delimiters. Use g for all matches, i for case-insensitive matching and d for capture positions.
JavaScript Regex Tester: how to use it
- Enter the pattern body without slash delimiters and enter JavaScript flags separately.
- Paste test text and select Test pattern. Inspect highlighted matches and expand the pattern tree.
- 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.