Regex Tester

zurapi.com

Character Classes

.Any character (except newline)
\dDigit [0-9]
\DNon-digit
\wWord char [a-zA-Z0-9_]
\WNon-word char
\sWhitespace
\SNon-whitespace
[abc]Character set
[^abc]Negated set
[a-z]Range

Anchors

^Start of string/line
$End of string/line
\bWord boundary
\BNon-word boundary

Quantifiers

*0 or more
+1 or more
?0 or 1
{n}Exactly n
{n,}n or more
{n,m}Between n and m
*?Lazy (non-greedy)

Groups & Lookaround

(abc)Capturing group
(?:abc)Non-capturing group
(?<name>)Named group
\1Backreference
a|bAlternation
(?=abc)Positive lookahead
(?!abc)Negative lookahead
(?<=abc)Positive lookbehind
(?<!abc)Negative lookbehind

Flags

gGlobal - find all matches
iCase-insensitive
mMultiline (^ $ match lines)
sDotAll (. matches \n)
uUnicode support

Replacement

$&Entire match
$1, $2Captured group
$`Before match
$'After match
$$Literal $