Pattern
/
/
Test String 0 matches
Matches 0
Enter a pattern and test string
to see matches here
to see matches here
Regex Cheatsheet
Character Classes
.Any character (except newline)
\wWord char [a-zA-Z0-9_]
\dDigit [0-9]
\sWhitespace
[abc]Any of a, b, or c
[^abc]Not a, b, or c
[a-z]Character range a to z
Anchors
^Start of string / line
$End of string / line
\bWord boundary
Quantifiers
*0 or more (greedy)
+1 or more (greedy)
?0 or 1 (optional)
{n,m}Between n and m times
*? +?Lazy (non-greedy)
Groups
(abc)Capture group
(?:abc)Non-capturing group
(?<n>abc)Named capture group
a|bMatch a or b
Lookaround
(?=abc)Lookahead
(?!abc)Negative lookahead
(?<=abc)Lookbehind
(?<!abc)Negative lookbehind
Common Patterns
Email[\w.+-]+@[\w-]+\.[a-z]{2,}
URLhttps?://[\w./%?&=+#@-]+
IP(\d{1,3}\.){3}\d{1,3}
Hex color#([a-fA-F0-9]{6}|{3})
Date\d{4}-\d{2}-\d{2}