MSRX Tools

Regex Tester

Test a pattern against sample text and see every match.

Everything runs inside your browser. Your files never leave your device.

Input

Result

The result appears here as you type.

Ask about Regex Tester

Questions about what this tool does, which option to pick, or what it can and cannot handle.

This is the one part of the site that uses a server. The question you type here is sent to an AI provider to be answered — your files and whatever you put in the tool above are not, and the assistant cannot see them. Answers are generated and can be wrong; the tool itself is not guessing.

About the Regex Tester

Regular expressions are written by iteration: try a pattern, look at what it caught, adjust. Doing that inside a program means a run cycle for every attempt. Doing it here means seeing every match update as you type.

The tester runs your pattern against your sample text using the browser's own regular expression engine, which is the same engine your JavaScript will use — so what matches here matches in your code. It shows every match one per line, or every match with its capture groups and their positions, or the text as it would look after a replacement, with backreferences like the first captured group written as a dollar sign and a number.

Flags are yours to set. Global finds every match rather than the first, case-insensitive is self-explanatory, multiline changes what the start and end anchors mean, and dot-all lets the dot match a newline. The tool forces the global flag internally when listing matches, so you get the full list even if you left it off.

An invalid pattern is reported with the engine's own explanation rather than silently producing nothing, which is the difference between debugging a pattern and staring at it.

How to use it

  1. 1Paste the text you want to search into the input box.
  2. 2Type your pattern into the Pattern field in the options — do not include the surrounding slashes.
  3. 3Set your flags: g for every match, i for case-insensitive, m for multiline, s for dot-matches-newline.
  4. 4Switch the output between plain matches, matches with capture groups, and the replaced result.
  5. 5For a replacement, type it in the Replace field using $1, $2 for captured groups.

Questions

Which regex flavour is this?
JavaScript, using the browser's built-in engine. Most patterns transfer to other languages, but lookbehind, named groups and Unicode property escapes vary — check the target language if the pattern is going somewhere else.
Should I include the slashes around my pattern?
No. Type the pattern only and put the flags in the flags field. A leading slash would be matched as a literal slash character.
Why do I only get one match?
For the replacement output, a missing g flag replaces only the first occurrence. Match listing forces the global flag internally, so it always shows every match.
How do I use a captured group in the replacement?
Write $1 for the first group, $2 for the second, and so on. $& inserts the whole match, and $$ inserts a literal dollar sign.
My pattern is very slow or the page freezes.
That is catastrophic backtracking — usually nested quantifiers such as a repeated group that is itself repeated. Simplify the pattern or make the inner quantifier lazy.