schwapps.
← All toolsDeveloper / 61

JavaScript Regex Tester — Matches, Positions, and Groups

Test an ECMAScript regular expression against text and inspect each match, position, and capture group.

Loading the tool… JavaScript is required for processing on your device. The instructions and examples below are available without JavaScript.

How to use it

Enter a pattern, flags, and test text to list matches with positions and capture groups.

Good to know

Uses the JavaScript regex engine. Patterns with catastrophic backtracking can freeze the tab.

Check a pattern before using it in code

Enter the pattern, flags, and sample text. The pattern (\w+)@(\w+)\.com with the g flag finds two matches in ada@example.com, grace@test.com, with first groups ada and grace and second groups example and test.

Results follow JavaScript semantics

This uses the browser’s JavaScript regular-expression engine, so syntax can differ from PCRE, Python, or a database flavor. The g flag finds all matches; without it, only the first match is reported. Patterns with catastrophic backtracking can make a browser tab slow or unresponsive, so simplify patterns and test them on short samples first.

Frequently asked questions

Which regex flavor does this use?

JavaScript (ECMAScript). Most syntax matches PCRE and Python, but lookbehind and named groups follow JavaScript rules.

What do the g, i, and m flags do?

g finds all matches, i ignores case, and m makes ^ and $ match at each line. s lets . match line breaks and u enables Unicode mode.

How do I see capture groups?

Each match lists its numbered and named groups underneath.