Regex Tester & Debugger
Write a regular expression, paste test text, and see live match highlighting with capture group breakdown and replace mode β all in your browser, instantly.
How to Use the Regex Tester
- Enter your pattern: Type your regular expression in the pattern field between the
/delimiters. Example:\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z]{2,}\b - Set flags: Toggle the flag buttons (g, i, m, s) or type directly in the flag field. The
gflag (global) is on by default to find all matches. - Paste test text: Type or paste the string you want to test against in the Test String area.
- Read results: Matches are highlighted in yellow in the result panel. The stats bar shows total match count. Scroll down to see capture group details per match.
- Try replace mode: Switch to the Replace tab, enter a replacement string (use
$1,$2for captured groups), and copy the transformed output.
Frequently Asked Questions
This tester uses JavaScript's native
RegExp engine. It supports all ES2022 features including named capture groups ((?<name>...)), lookbehind assertions, and the d indices flag. Results are identical to what you'd get in Node.js or any modern browser.g (global) β find all matches instead of stopping at the first. i (ignore case) β make the pattern case-insensitive. m (multiline) β make
^ and $ match the start/end of each line, not just the whole string. s (dotAll) β make the dot . match newline characters too.Write
$1, $2, etc. in the replacement field to refer to the first, second, etc. capture group. For named groups ((?<year>\d{4})), use $<year>. For example, the pattern (\w+)\s(\w+) with replacement $2, $1 swaps first and last name.A red border means your regex has a syntax error. The error message below the pattern field shows the exact problem. Common mistakes include unmatched parentheses
(, unescaped special characters, or invalid flag combinations.Yes. Everything runs in your browser with zero server communication. Your test strings and patterns are never sent anywhere. There are no accounts, no rate limits, and no ads targeting your content.
Yes. Enable the
m (multiline) flag so that ^ and $ anchors match the start and end of each line. Enable s (dotAll) if your pattern uses . and needs to match across line breaks.