Type a pattern and see every match highlighted in the text below it, live. Capture groups, named groups and a replacement preview are all shown. This is the JavaScript regex engine — the same one your browser and Node use — not an approximation of it.
This is the JavaScript flavour specifically
JavaScript has no \A or \Z anchors — use ^ and $ with or without the m flag. It has no possessive quantifiers and no atomic groups. It has no inline flag syntax: (?i) is a syntax error, and the i goes in the flags box. Lookbehind ((?<=…)) is supported and has been since 2018, unlike in several other engines.
If you are writing a pattern for a JavaScript codebase, this is exactly right. If you are writing one for a Python script, test it in Python.
The flags, briefly
g — find every match rather than only the first. Always on here, because a tester that shows one match is not useful.
i — case-insensitive.
m — makes ^ and $ match at each line break instead of only at the ends of the whole string. This is the flag people forget when a pattern works on one line and fails on a file.
s — makes . match newlines too. Without it, . stops at every line break.
u — proper Unicode handling, needed for \p{…} property escapes and for matching astral characters like emoji as single units.
Catastrophic backtracking
(a+)+b against a long run of as will hang a tab, and in production it is a denial-of-service vector known as ReDoS.
Matching here is capped at 5,000 results and you are told when the cap was hit, but a genuinely pathological pattern can still be slow because the cost is in the backtracking, not the match count. If typing a pattern makes the page freeze, that is the pattern telling you something important about what it would do to your server.
Replacement syntax
$1 is the first capture group, $<name> is a named group, $& is the whole match and $$ is a literal dollar sign. The preview updates live, so you can see the result before running it anywhere real.Other names for this
Also searched as “regex101 alternative”, “regexp tester”, “test regular expression”.
Questions
- My pattern works here but not in Python.
- The flavours differ. JavaScript has no inline flags, no atomic groups and no \A/\Z anchors; Python has no lookbehind of variable width. Test in the language you will ship in.
- Should I paste the slashes around my pattern?
- No. Enter the pattern only and put flags in the Flags box. A pasted /pattern/gi is treated as a pattern that literally starts with a slash.
- Why is it only showing 5,000 matches?
- That is a cap to keep the page responsive. It is reported when reached, so you never see a truncated count presented as complete.
- Does my text leave the browser?
- No. Everything runs as JavaScript in this tab — there is no server involved and no request is made. Open the Network panel and watch, or turn your Wi-Fi off and keep using the tool.