Regex Tester

Test regular expressions with live highlighting. Toggle flags and see matches instantly.

/

How it works

Enter your regular expression pattern in the pattern field and paste the text you want to test in the Test String area. Toggle the g, i, m, and s flags using the checkboxes. Matches are highlighted live in the highlighted output panel and listed individually below with their index position and any named capture groups. Click the Regex Cheat Sheet button to expand a reference of common patterns. Everything runs in the browser using the native JavaScript RegExp engine.

Frequently asked questions

What regex flags does this tester support?

g (global — all matches), i (case-insensitive), m (multiline — ^ and $ match line boundaries), and s (dotAll — . matches newlines). The g flag is on by default so all matches are highlighted simultaneously.

What are named capture groups?

Named groups use (?<name>pattern) syntax and let you reference a matched group by name instead of index. For example, (?<year>\d{4}) captures four digits as "year". The tester shows named groups alongside each match result.

Why does my regex match nothing with the m flag?

The m flag only changes ^ and $ to match line boundaries — it does not make . match newlines. Enable the s (dotAll) flag as well if you need . to match across line breaks.

What is the difference between \d and [0-9]?

In JavaScript regex, \d and [0-9] are equivalent — both match one decimal digit. \d is shorter. The negated form \D matches any non-digit character.