Tool guide

Regex Tester Guide

Reference for JavaScript regex flags, match indexes, capture-group counts, worker timeouts, input limits, and reproducible pattern checks.

Engine and flags

Regex Tester uses the browser's JavaScript RegExp engine. Enter the pattern without surrounding slash delimiters, enter flags separately, and provide representative sample text. Syntax support follows the browser; a working JavaScript pattern is not proof that it works in a database, Python or another runtime.

The tester adds global matching when the g flag is absent so it can build a match list. It does not silently remove unknown flags or deduplicate them: unsupported, repeated or incompatible flags return an error. The result shows the evaluated flags, matched text, UTF-16 match indexes and capture-group counts. Individual captured values are not displayed.

A concrete matching check

Pattern AL-(\d+), flag g, and text AL-1024 AL-2048 XX-1024 should match AL-1024 at index 0 and AL-2048 at index 8, with one capture group per match. The group's values in JavaScript are 1024 and 2048; inspect these in your target runtime when verifying individual captures. XX-1024 should not match. Add a boundary if a longer surrounding token must be rejected: the basic pattern does not itself promise whole-token matching.

When sharing the pattern, include the exact text, flags, desired matches and intended non-matches. Empty matches, Unicode characters and line boundaries deserve separate fixtures. Multiline mode changes anchors; it does not make every token span lines.

Limits and failure handling

Each attempt runs in a dedicated Web Worker that can be terminated without waiting for the regular expression to finish. Editing the input cancels the previous worker. An attempt has a 1.5-second timeout, including worker startup; a timeout does not mean that the pattern has no matches. Shorten the sample or simplify nested quantifiers before retrying.

The collector stops at 100 matches instead of first building an unlimited match array. When the limit is reached, the display says First 100; this is not a count of all possible matches. Text is limited to 50,000 UTF-16 code units and patterns to 2,000. Oversized input is rejected, not silently truncated. A supplementary Unicode character can occupy two UTF-16 code units.

The tool requires Web Worker support. If a worker cannot start, it reports an error rather than running an untrusted pattern on the page's UI thread. An error-free expression can still have false positives or miss required cases.

Use a parser for structured JSON instead of trying to validate its grammar with one expression. JSON Formatter checks JSON syntax; Diff Checker compares text revisions. Neither substitutes for application-level validation.

Processing happens in the browser and does not send sample text to a regex service. See Data handling. Remove private values before sharing a pattern fixture in a ticket, even when the test itself ran locally.

Related tools