regex --test
Regex tester
Test JavaScript regular expressions as you type. Matches light up in the text, capture groups come with their positions, and every part of the pattern is explained in plain English. Nothing leaves your browser.
Type a pattern to see its matches.
text.replace(regex, replacement)Good to know
The tester uses the regex engine of your browser, so what you see is exactly what RegExp does in JavaScript and TypeScript. Most patterns behave the same in other languages, but details differ: Python writes named groups as(?P<name>…), and Go has no lookarounds or backreferences.
Positions are counted like JavaScript counts them, in UTF-16 units from 0, with the end not included. So 0–4 is whattext.slice(0, 4) returns.
Patterns run in a background worker with a time limit. If one gets stuck in catastrophic backtracking, as(a+)+$ does on a long row of a's followed by something else, it is stopped after 1.5 seconds and the page stays usable.