inyourbrowser.com

Regex match tester

Enter a regular expression pattern and a test string to list every match as you type, each with its position and capture groups. Supports the global, case-insensitive, multiline, dotAll, Unicode, and sticky flags.

//
Test string
0 matches
Enter a pattern and test string above

MODE

Runs entirely in your browser

How it works

The tool uses the browser's native JavaScript RegExp engine. Patterns are compiled with new RegExp(pattern, flags) and run in a Web Worker that is stopped after 2 seconds, so a runaway pattern cannot freeze the page. Invalid patterns show an error message next to the pattern and never crash the page.

Processing runs in your browser

Both the pattern and the test string are processed entirely in your browser. Our servers are not involved at any point.

Related operations

For plain substring swaps without regex, try find and replace. To validate JSON patterns you are matching, use the JSON formatter. For decoding escape sequences in HTML attribute values, see HTML entities.

Frequently asked questions

What does the global flag (g) do?
With the global flag, all non-overlapping matches are found and listed. Without it, only the first match is returned.
What does the number after @ mean?
It is the index where the match starts, counted from 0 in UTF-16 code units: the same value as match.index in JavaScript. Matching cat in a cat shows @ 2.
Why does a group show undefined?
A group that took no part in the match has no value. With (a)|(b) against b, the list shows $1="undefined" and $2="b", which is what JavaScript returns.
How are empty matches handled?
A pattern that can match an empty string, such as \b or ^ with the m flag, lists each empty match at its position. After each one the tester moves forward one character (one code point with the u flag), so the list always ends.

Last reviewed September 30, 2026

Other pages for this tool

Related tools

Find & replace
Find and replace text with plain search or regular expressions. Supports case-sensitive and whole-word matching.
SQL formatter
Beautify and format SQL queries. Supports MySQL, PostgreSQL, T-SQL and standard SQL.
Cron expression explainer
Parse any cron schedule into plain English and see the next run times. Fully in-browser.