Developer Tools

Regex Tester

A small test sample can reveal whether a pattern matches too much, too little or nothing at all. Enter JavaScript regex syntax without the surrounding slash delimiters, then list matched text, offsets and capture groups. The global flag controls whether the tester continues after the first match. Matching runs in a separate worker with a time limit, so a pattern with excessive backtracking does not lock the page. Results use JavaScript string indexes, which count UTF-16 code units rather than visual characters.

Your workspace

Runs locally in your browser

Result

Your input is processed locally in your browser unless explicitly stated otherwise. Inputs are not saved by this tool.

How to use this tool

Enter a pattern without surrounding slashes, choose flags, and supply test text. Select Test to list match positions and captures.

Example

Input

Pattern: \bcat\b | Text: a cat and a cat

Output

2 matches: cat at index 2; cat at index 12

What does this tool do?

Regular expressions describe patterns in text. This tester uses the JavaScript RegExp engine, so its behavior may differ from PCRE, Python or database engines.

Common mistakes and limitations

g finds all matches; i ignores case; m changes line anchors; s lets dot match newlines; u enables Unicode mode. Expensive patterns are stopped after a short timeout. Output is capped at 1,000 matches.

Frequently asked questions

Why does another language produce different matches?

Regex engines have different syntax and Unicode rules. Test the expression in the runtime where it will be used.

Related tools