ToolJovia
Developer

Regex Tester

Test JavaScript regular expressions in an isolated worker with a 250 ms timeout and readable match positions.

✓ Browser-local processing
Supported flags: g, i, m, s, u.

Loading tool…

How to use Regex Tester

Check a JavaScript regular expression against sample text. A dedicated worker keeps expensive patterns away from the page, and the worker is terminated after each run.

  1. Enter a JavaScript regex pattern without slash delimiters.
  2. Choose flags and provide sample text.
  3. Run the test to inspect match text, character indices, and capture groups.

Good to know

  • Worker loading has a separate 10-second limit. The 250 ms pattern-processing limit starts only after the worker reports that it is ready.
  • Up to 1,000 pattern characters, 50,000 sample characters, and 200 displayed matches. Long matches and groups are abbreviated.
  • JavaScript regex syntax differs from PCRE, Python, and other engines. Indices are UTF-16 code-unit offsets.

Extract letter-number codes with two capture groups

Enter the pattern without slash delimiters, set Flags to g, and paste the sample text. Parentheses capture the letter prefix and numeric suffix separately. The g flag finds both codes; i alone reports the first match. Empty Flags defaults to g. Match positions are zero-based UTF-16 offsets, with an exclusive end position. They identify locations in the supplied JavaScript string, not byte positions in a file. Use this small example to confirm your capture groups before testing a longer log or changing the expression.

Pattern, flags and sample text

Pattern: ([A-Z]+)-(\d+)
Flags: g
Sample: AB-12 CD-7

Expected match report

Match 1: index 0, end 5
"AB-12"

Capture groups: 1: "AB", 2: "12"

Match 2: index 6, end 10
"CD-7"

Capture groups: 1: "CD", 2: "7"
Try this in the tool

Common questions

Can a difficult pattern freeze the page?

The pattern runs in a separate worker that is terminated if the safety timeout is reached.

What happens with an empty match?

The tester advances by one code point in Unicode mode, or one code unit otherwise, so global empty matches terminate.

Keep going with related tools

All developer →