Regex Tester

Type a pattern and a test string — matches are highlighted live as you type, with capture groups listed below. Uses the same regex engine as your browser's JavaScript.

No matches

How to use

Enter a pattern in the first field (without the surrounding slashes) and flags like `g`, `i`, or `m` in the second. Matches in your test string highlight instantly, and if your pattern has capture groups, each match's captured values are listed underneath.

Because this uses JavaScript's native `RegExp` engine, patterns behave exactly as they would in a browser, Node.js, or any JS codebase — no surprises from a different regex flavor (like PCRE or Python's `re`) behaving slightly differently than what you tested here.

FAQ

What do the regex flags mean?

`g` (global) finds all matches instead of stopping at the first one; `i` makes matching case-insensitive; `m` makes `^`/`$` match the start/end of each line rather than the whole string; `s` lets `.` match newlines; `u` enables full Unicode mode.

Why does my pattern work here but not in Python or PHP?

Regex "flavors" differ slightly between languages — Python's `re`, PCRE (used by PHP, and via a compatibility mode by some other tools), and JavaScript's engine handle some features (like lookbehind support, named groups syntax, or possessive quantifiers) differently. This tool tests JavaScript's flavor specifically.

How do capture groups work?

Parentheses in a pattern, like `(\d+)`, capture the matched text as a numbered group you can reference or extract separately from the full match. This tool lists each match's captured groups directly below the highlighted text.

Is my test string sent anywhere?

No — matching happens entirely in your browser via JavaScript's built-in regex engine. Neither your pattern nor your test data is transmitted or logged.

More tools