Regex Tester
Write a regular expression and paste your text: matches are highlighted in place, and every match is listed with its position and capture groups. It uses JavaScript's own regex engine, and your text never leaves your browser.
This tool runs entirely in your browser; what you enter is never sent to our servers.
How to use it
- Write the regular expression and pick the flags you need (g, i, m, s, u).
- Paste the text to test; matches are highlighted as you type.
- Optionally enter a replacement ($1, $<name>) and copy the result.
How to test a regular expression
A regular expression (regex) describes a pattern to find in text: \d is a digit, \w a letter, digit or underscore, \s whitespace, and . any character; + means one or more, * zero or more, ? optional, and {2,4} between two and four repeats. Parentheses () capture a group, and (?<name>…) gives it a name. Flags change how the search runs: g finds every match (otherwise only the first), i ignores case, m makes ^ and $ match at each line, s lets the dot match line breaks, and u turns on Unicode mode (recommended for accented letters and emoji). The tool runs your browser's JavaScript engine, so an expression that works here behaves the same in JavaScript and TypeScript code. PHP, Python and Java use very similar syntax but differ in some details.