Regex Tester
Type a pattern and some text: every match is highlighted as you type, listed with its position and capture groups, and you can preview a replacement. Common patterns for emails, URLs and dates are one click away.
Enter a pattern and some text to test it against.
About this tool
Regular expressions describe text patterns with a compact syntax: a dot matches any character, \d a digit, \w a word character, + and * repeat, and parentheses capture groups you can reuse in a replacement as $1, $2 or $<name>. The tester uses your browser's JavaScript engine, so behaviour matches Node.js and every modern browser exactly.
Flags change how the pattern is applied. g finds every match instead of the first, i ignores case, m makes ^ and $ work per line, s lets the dot match newlines, u switches on full Unicode and y anchors the search to the current position. The highlight view always searches globally so you can see every occurrence; the replace preview respects the flags you set.
Frequently asked questions
- Which regex flavour is this?
- JavaScript (ECMAScript), as used by browsers and Node.js. Most patterns written for PCRE, Python or Java work unchanged; lookbehind and named groups are supported in current browsers.
- How do I use capture groups in the replacement?
- Wrap the part you need in parentheses and refer to it as $1, $2 and so on, or use (?<name>…) and $<name>. $& inserts the whole match.
- Why does my pattern match only once?
- Without the g flag JavaScript stops at the first match. The highlight view shows all matches anyway; enable g to make the replacement apply to every occurrence.
- Is my text sent anywhere?
- No. The pattern runs entirely in your browser, so you can safely test on logs, exports or personal data.