How to use a regex tester

A regex tester lets you change a pattern, flags, and sample text together, then inspect matches and capture groups before putting the expression into code.

Open the Regex Tester

Start with the matching goal

Write down what should match and what must not match. A useful test set includes normal cases, boundary cases, empty input, near misses, and Unicode text when the application accepts it.

The ToolPixels tester expects the pattern without surrounding slash delimiters and uses the JavaScript regular-expression engine available in your browser.

How to use the regex tester

  1. Enter the pattern without leading or trailing slashes.
  2. Add only the JavaScript flags you need.
  3. Paste representative sample text.
  4. Select Test regex.
  5. Inspect matched text, indexes, and capture groups, then add negative cases.

A practical pattern example

\b([A-Z]{2})-(\d{4})\b

Against Ticket AB-2048 is open, the full match is AB-2048. Capture group 1 is AB and group 2 is 2048.

Word boundaries keep the pattern from matching inside a longer word. Whether that is desirable depends on the input format.

Common JavaScript flags

FlagEffect
gFind all matches
iIgnore letter case
mLet anchors work per line
sLet dot match line terminators
u or vUnicode-aware parsing modes

Without g or sticky y, only the first match is returned.

Performance and index cautions

  • Nested ambiguous quantifiers can cause excessive backtracking.
  • Match indexes count UTF-16 code units, not visible characters.
  • Unmatched optional capture groups appear as null.
  • Browser support for newer flags varies.
  • A regex is often the wrong tool for fully parsing HTML or other nested grammars.

This tester limits patterns, returns at most 1,000 matches, and stops processing after two seconds.

Use the browser tool

Test JavaScript regular expressions locally with supported flags, matches, groups, and a separate worker timeout.

Test a regex