Regex Tester
Test a regular expression against sample text and see every match highlighted.
How to use Regex Tester
- Enter a regular expression pattern and choose which flags to apply (g, i, m, s).
- Paste your test text — every match is highlighted instantly, with a list of matches and captured groups below.
- Switch to Replace mode to preview what replacing every match with a given string would produce.
About this tool
The Regex Tester runs a regular expression against text you provide, highlights every match inline, and lists each match with its position and any captured groups. It also supports a replace mode to preview what String.replace() would produce. All processing runs instantly in your browser using JavaScript's native regex engine — nothing is uploaded or sent to a server.
Frequently Asked Questions
Which regex flavor does this use?
JavaScript's native regex engine (the same one used in browsers and Node.js) — since all processing happens in your browser. Syntax is very similar to PCRE but has some differences, particularly around lookbehind support in older engines and named group syntax.
What do the flags mean?
g (global) finds all matches instead of stopping at the first; i (case-insensitive) ignores letter case; m (multiline) makes ^ and $ match the start/end of each line instead of the whole string; s (dotAll) makes '.' also match newline characters.
Why does my pattern show an error?
The pattern isn't valid JavaScript regex syntax — common causes are an unclosed group (missing closing parenthesis), an unescaped special character, or an invalid flag combination. The error message shows exactly what the regex engine rejected.