Regex Tester
Test a regular expression against your text, with live highlighting, groups and replace.
Matches
Replace
How to use the Regex Tester
- Write the patternType a JavaScript regular expression between the slashes and pick the flags.
- Add test textPaste the text to search. Matches are highlighted as you type.
- Check and replaceSee each match and its groups, and try a replacement using $1, $2 and so on.
Example
Pattern (\w+)@(\w+)\.com with flag g on “hello@magiknex.com or support@example.com” finds 2 matches.
Replacement $1 at $2 turns them into hello at magiknex and support at example.
Frequently asked questions
Which regex flavour does this use?
JavaScript (ECMAScript), as used in browsers and Node.js. Most patterns also work in Python, PHP and Java, but some features such as lookbehind or named groups differ slightly.
What do the flags mean?
g finds every match instead of only the first, i ignores upper and lower case, m makes ^ and $ work on each line, s lets the dot match line breaks, and u enables full Unicode support.
How do I use capture groups in the replacement?
Put part of the pattern in brackets to capture it, then use $1 for the first group, $2 for the second, and $& for the whole match.