Regex Tester

Test regular expressions with live match highlighting.

Frequently asked questions

Which regex flavor is this?
JavaScript's RegExp engine — the same one running in Node.js and every browser. Features like lookbehind and named groups are supported in modern engines.
Why use the /g flag?
The global flag makes the engine scan the whole text and report every match instead of stopping at the first one. This tool highlights all matches, so add g unless you only want the first.
What do the common flags mean?
g scans the whole text for every match, i ignores case, m makes ^ and $ match each line, s lets . match newlines, and u enables full Unicode matching. Flags can be combined, for example "gim".
Why does my pattern match more or less than expected?
Check anchors (^ and $), escaped characters, and greedy quantifiers such as .* which consume as much as possible. Without the g flag the engine stops after the first match. The Explain panel and the match list help pinpoint the difference.
Can I test replacements here?
This tester focuses on matching and explanation; it does not apply replacements. Once the pattern and flags behave correctly, use String.replace or your language's regex replace API with the same expression.

About this tool

This tester runs JavaScript regular expressions against your sample text and highlights every match as you type. It uses the browser's own RegExp engine, so patterns behave exactly as they will in Node.js and front-end code. The Explain panel translates pattern tokens into plain English, which makes complex expressions easier to debug.

How to use it

  1. Enter a pattern without the surrounding slashes.
  2. Set flags such as g for every match, i for case-insensitive and m for multiline.
  3. Paste the text to test; matches are highlighted live.
  4. Open the Explain panel to see what each part of the pattern does.

← All tools