About Regex Tester
Regex Tester helps you write, debug and understand regular expressions. Every match is highlighted as you type, capture groups are listed one by one, and you can preview replacements before using the pattern in your code.
How it works
Your pattern is compiled with the browser's native JavaScript regex engine, so what you see here is exactly what runs in Node.js, Deno and every modern browser. Modern features are supported, including named groups ((?<year>\d{4})), lookbehind ((?<=\$)\d+) and Unicode property escapes such as \p{L} with the u flag.
Matching runs in a background worker with a time limit. A pattern with catastrophic backtracking, like (a+)+$ on a long string, can't freeze the page. You'll get a timeout warning instead, which is also a useful hint that the pattern could hang in production.
Quick reference
\ddigit,\wword character,\swhitespace,.any character*zero or more,+one or more,?optional,{2,5}between 2 and 5^start and$end of the text (or of each line with themflag)( )capture group,(?: )non-capturing group,a|beither a or b[abc]one of these characters,[^abc]none of these
Tips for better patterns
- Start from the pattern library (emails, URLs, dates, phone numbers) and adapt it rather than writing from scratch.
- Add the
gflag to see every match, not just the first. - Use anchors (
^…$) when validating a whole input, so "abc123xyz" doesn't pass as a number. - Prefer specific classes like
[^"]*over.*. They're faster and less likely to over-match. - Name your groups.
$<year>is far easier to read than$3six months later.