Account

What new tool do you want?

Developer Tools

Regex Tester

Test JavaScript regular expressions live — see every match highlighted, capture groups, named groups and match positions.

How to use

  1. 1Enter your pattern and flags (g, i, m, s, u).
  2. 2Paste test text; matches are marked with [brackets] and listed with their groups.

Frequently asked questions

Which regex flavor is used?

JavaScript (ECMAScript), as in browsers and Node.js. It supports lookbehind, named groups (?<name>…) and Unicode property escapes with the u flag.

Why does my pattern only find one match?

Add the g (global) flag to find all matches. Without it, JavaScript stops at the first one.

What does the m flag do?

Multiline mode: ^ and $ match at the start and end of every line instead of only the whole text.

Worked example: Regex Tester

Testing \b(\w+)@(\w+)\.com\b with the g flag against "[email protected], [email protected]" highlights both matches inline as [[email protected]], [[email protected]] and lists each one's capture groups separately: match #1 at position 0 captures $1: "ann" and $2: "site"; match #2 at position 14 captures $1: "bob" and $2: "mail" — the two parenthesized groups in the pattern map directly to $1 and $2 for every match found, which is exactly the information you need when deciding how to extract fields in real code afterward.

Why forgetting the g flag is the most common confusion

JavaScript's regex engine stops at the very first match unless the global flag is present — this tool always tests with g appended internally even if you don't type it, specifically so the match count behaves predictably, but it's worth understanding why: in your own code, calling .match() or .exec() on a pattern without g silently returns just one result even against text with five matches, which looks like a bug in the pattern when it's actually just missing flag. This tool auto-adds g for the live match list but still respects whether you typed it for display purposes, since named/numbered capture-group inspection genuinely wants to show you every match it finds.

Why multiline mode changes ^ and $ but not .

Without the m flag, ^ and $ anchor to the very start and end of the entire input string, so a multi-line block of text only has one "start" and one "end" no matter how many line breaks it contains. Adding m makes ^ and $ match at every line boundary instead — useful for validating each line of a pasted list independently. It's easy to assume m also makes . match newlines, but that's a separate flag entirely (s, dotAll) — without s, . still refuses to match \n even in multiline mode, which is a frequent point of confusion when a pattern seems to mysteriously stop partway through a multi-line match.

Unknown flag letters are dropped, and a missing g shows one match

The pattern opens on a word, an at-sign, a word, and .com. Flags open on g. Letters outside the usual flag set are stripped before the pattern runs. If I leave g out, only the first match is marked, even when the text has more. With g, I get up to 1,000 matches. An empty pattern stops with "Enter a pattern to test." A pattern that will not compile shows the reason. A capture that did not take part in a match is labeled (no match), so I can tell a missing group from an empty one.

Related tools

More: Developer Tools