Skip to content
1001 Tools
sr
Developer tools

Regex Tester

Type a regular expression and some text, and see the matches update instantly. Each match shows where it starts and what its capture groups caught — both numbered and named. It uses your browser’s own JavaScript regex engine, so results are exactly what your code will get.

Enter a pattern to see matches.

Uses your browser’s JavaScript regex engine. The global flag is applied automatically; up to 200 matches are listed.

How it works

Enter the pattern between the slashes and the flags (like g, i, m) on the right. The tester compiles it with new RegExp and runs it over your subject text, listing every match. The global flag is applied automatically so you always see all matches, not just the first — you don’t have to remember to add g.

For each match you get the matched text, its zero-based index, every numbered capture group in order, and any named groups from (?<name>…) syntax. Groups that didn’t participate in a match show as a dash. Invalid patterns or flags are reported with the engine’s own error message so you can fix them quickly.

Practical examples

Pulling numbers out of text

The pattern \d+ against “a12 b34” finds 12 at index 1 and 34 at index 5 — a quick way to confirm a pattern grabs what you expect before using it in code.

Named groups for a date

(?<y>\d{4})-(?<m>\d{2})-(?<d>\d{2}) on “2026-07-15” returns y=2026, m=07, d=15, exactly the object you’d read from match.groups in JavaScript.

Case-insensitive search

With the i flag, abc matches “ABC” once; without it, zero matches. Toggling the flag is the fastest way to see its effect.

Frequently asked questions

Which regex flavour does it use?

JavaScript’s (ECMAScript) regular expressions, via your browser’s built-in engine. That means results match exactly what you’d get in Node or front-end code — but not necessarily PCRE, Python or .NET, which differ in some syntax.

Do I need to add the g flag?

No. The tester adds a global flag internally so it can list every match. You can still type g yourself; it makes no difference to the results shown here.

What flags are allowed?

The standard JavaScript set: g (global), i (ignore case), m (multiline), s (dotall), u (unicode) and y (sticky). Any other character is rejected with an “invalid flags” message.

What do the numbers next to each match mean?

The number after @ is the zero-based index where the match starts in your text. The numbered lines below a match are its capture groups, in order; a dash means that group didn’t participate.

How are named groups shown?

If your pattern uses (?<name>…), each named group is listed by its name and captured value under the match, mirroring the match.groups object in JavaScript.

Why might a pattern hang the page?

Certain patterns (catastrophic backtracking) can take a very long time on some inputs. Because the regex runs in your own browser tab, a pathological pattern can freeze it briefly — simplify the pattern if that happens.

Is there a limit on matches shown?

The list displays up to 200 matches to keep the page responsive; the count above always reflects the true total. Narrow your pattern if you need to inspect beyond that.

Is my text sent anywhere?

No. Both the pattern and the subject text stay in your browser; nothing is uploaded.

Related tools