DevMate
Back to Toolverse

Development

Regex Tester

Try a pattern against a short fixture and inspect match offsets and captured groups before using it in application code.

Local processing
Loading tool workspace...

About this tool

When to use it

Try a pattern against a short fixture and inspect match offsets and captured groups before using it in application code.

How to use it

Enter the pattern without slash delimiters, choose JavaScript flags, paste test text, and select Test expression. Include a matching and a nonmatching example. Compare the returned groups with the values your code needs rather than checking only that something matched.

Guide updated . Examples checked against this implementation.

Worked examples

Find numeric runs

Input

Pattern: \d+; Flags: g; Text: build 42, job 7

Expected output

42 at index 6
7 at index 14

Indices are zero-based UTF-16 offsets. The display also numbers matches; those row numbers are separate from text offsets.

Errors and unsupported input

(a+)+

Nested unbounded repetition is blocked. Simplify the expression and test against a small representative string before broadening it.

Continue this workflow

  • Regex Cheatsheet: Look up anchors, groups, and flags before extending a pattern.

Questions

Frequently asked questions

Why do emoji affect an index?

An emoji can occupy two UTF-16 code units. Match offsets follow JavaScript string indexing rather than the number of visible glyphs.