Developer guide
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 TesterStart 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
- Enter the pattern without leading or trailing slashes.
- Add only the JavaScript flags you need.
- Paste representative sample text.
- Select Test regex.
- 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
| Flag | Effect |
|---|---|
g | Find all matches |
i | Ignore letter case |
m | Let anchors work per line |
s | Let dot match line terminators |
u or v | Unicode-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.