Skip to content

Regex Tester

Test JavaScript regular expressions live, with highlighted matches and capture groups.

Regex quick reference

TokenMeaning
.Any character except a newline (unless the s flag is set)
\d \w \sDigit, word character, whitespace (uppercase versions negate)
[abc] [^abc] [a-z]Character sets, negated sets, ranges
* + ? {2,5}Quantifiers; add ? to make them lazy
^ $ \bStart, end and word boundary
( ) (?: ) (?<name> )Capturing, non-capturing and named groups
(?= ) (?! ) (?<= )Lookahead, negative lookahead, lookbehind

Flags

g global · i case-insensitive · m multiline anchors · s dot matches newlines · u Unicode · y sticky. This tester always applies g so it can list every match.

Avoid catastrophic backtracking

Nested quantifiers such as (a+)+$ or (.*)* can take exponential time on inputs that almost match, a denial-of-service risk known as ReDoS when patterns run on user input. Prefer specific character classes, anchor patterns, and avoid quantifying groups that themselves contain quantifiers.