Regex tester

Regex tester

Test a JavaScript regular expression against sample text and read every match and group.

About this tool

A regular expression is a pattern for finding text. The flags change how it works: g finds every match, i ignores case, m treats each line as its own, s lets a dot cross newlines, and u turns on Unicode rules.

Paste a JavaScript pattern and some sample text to see every match and its capture groups. An invalid pattern is shown as an error, not a broken page. The test runs only in your browser.

Worked example

The pattern (\d{4})-(\d{2})-(\d{2}) with the g flag finds both dates in "2026-01-02 and 2027-03-04" and puts the year, month and day in groups 1, 2 and 3.

Common searches