DevToolBoxDevToolBox

Regex Quick Reference

A comprehensive regex syntax reference covering character classes, anchors, quantifiers, groups, backreferences, lookahead/lookbehind, and flags. Searchable and categorized for quick lookup. Includes examples for each pattern.

Character Classes

.Any character except \n
\dDigit [0-9]
\DNot a digit
\wWord char [a-zA-Z0-9_]
\WNot a word char
\sWhitespace
\SNot whitespace
[abc]a, b, or c
[^abc]Not a, b, or c
[a-z]Range a to z

Anchors

^Start of string/line
$End of string/line
\bWord boundary
\BNot 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

Groups & Lookaround

(abc)Capture group
(?:abc)Non-capture group
(?<name>abc)Named group
\1Back-reference
(?=abc)Positive lookahead
(?!abc)Negative lookahead
(?<=abc)Positive lookbehind
(?<!abc)Negative lookbehind

Flags

gGlobal — all matches
iCase-insensitive
mMultiline (^ $ per line)
sDotall (. matches \n)
uUnicode
ySticky

Special Characters

\nNewline
\rCarriage return
\tTab
\\Backslash
\.Literal dot
\|Literal pipe

Frequently Asked Questions

Related Tools