Any character
Any single character except newline
$.Regex pattern reference.
Any single character except newline
$.Matches a digit (0-9)
$\dMatches anything that is not a digit
$\DMatches [A-Za-z0-9_]
$\wMatches anything not [A-Za-z0-9_]
$\WSpace, tab, newline, carriage return
$\sAny non-whitespace character
$\SMatches any listed character
$[aeiou]Matches anything not listed
$[^aeiou]Lowercase letters
$[a-z]Greedy match 0 or more times
$*Greedy match 1 or more times
$+Optional match (0 or 1)
$?Exactly n times
${n}At least n times
${n,}At least n and at most m times
${n,m}Non-greedy version of *
$*?Matches start of input
$^Matches end of input
$$Position between word and non-word character
$\bNot a word boundary
$\BStart of line when /m flag is set
$^Groups and captures matched text
$(abc)Groups without capturing
$(?:abc)Group with a name reference
$(?<name>abc)Match either side of |
$cat|dogFind repeated word using \1
$\b(\w+)\s+\1\bMatch foo only if followed by bar
$foo(?=bar)Match foo only if NOT followed by bar
$foo(?!bar)Match bar only if preceded by foo
$(?<=foo)barMatch bar only if NOT preceded by foo
$(?<!foo)barFind all matches, not just the first
$/pattern/gIgnore case
$/pattern/i^ and $ match start/end of each line
$/pattern/m. matches newlines too
$/pattern/sTreat pattern as Unicode
$/pattern/uMatch from lastIndex only
$/pattern/yBasic email validation
$^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$HTTP or HTTPS URL
$https?://[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=]+Valid IPv4 address
$\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b(555) 123-4567 or 555-123-4567
$^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$YYYY-MM-DD
$^\d{4}-\d{2}-\d{2}$#fff or #ffffff
$^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$8+ chars, 1 upper, 1 lower, 1 digit
$^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$3-16 alphanumeric or underscore
$^[a-zA-Z0-9_]{3,16}$