DoItAl

Data utility

Regex Tester

Test JavaScript regular expressions locally with flags, match positions and capture groups. A separate browser worker stops slow patterns after two seconds.

Browser-local • No upload

Loading tool controls…

Local tool controls
Flags

Uses JavaScript RegExp semantics, without / delimiters. Indexes count UTF-16 code units. Execution runs in a local worker with a 2-second timeout. Up to 200 matches, 12 numbered/named groups, 2,000 match characters and 300 characters per group are displayed. This is not PCRE, Python or .NET syntax.

What this tool does

Evaluates a JavaScript regular expression against text, showing match positions, numbered captures and named capture groups.

How to use it

  1. Enter the pattern without surrounding slash delimiters.
  2. Choose global, case-insensitive, multiline, dot-all or Unicode flags and provide test text.
  3. Run the test, inspect matches and groups, then revise or clear your inputs.

Worked example

Pattern (?<word>\w+) with flags gu against ‘Hello world’ returns Hello at indexes 0–5 and world at 6–11, each with a named word capture. End indexes are exclusive.

Processing and explanation

Matching uses the browser’s JavaScript RegExp engine in a separate module worker. The main tab terminates that worker after two seconds, including worker startup. Global zero-length matches advance the search position safely, respecting Unicode surrogate pairs when the Unicode flag is selected.

Limits and common mistakes

Pattern up to 2,000 and test text up to 100,000 UTF-16 code units; 200 displayed matches, 12 numbered and 12 named groups. Match text clips at 2,000 characters and each group at 300. Slow patterns time out; browser support determines available JavaScript syntax. PCRE, Python, .NET syntax and replacement previews are unsupported.

Privacy and your input

Pattern matching runs in a local worker. Patterns, test strings and captures are not uploaded, stored or added to analytics. Editing an input cancels any running test; clearing or leaving the page terminates the worker.

Frequently asked questions

Why do indexes differ from visible character counts?
JavaScript match positions count UTF-16 code units, so an emoji can occupy two positions.
Why does only one match appear?
Enable the global flag to collect more than the first match.
What happens to an expensive pattern?
After two seconds the local worker is terminated. The page remains usable and a simpler pattern can be tested again.

Material content update: