Dot (.):
Matches any
single character except for a newline.
Literal Characters (a, B,
5):
Any normal character matches itself exactly.
Main Quantifiers:
Specifies how many times the preceding part can
repeat.
* (Asterisk): Matches
zero or more times.
+ (Plus): Matches
one or more times.
? (Question Mark):
Matches zero or one time.
Brace Quantifiers:
Allows you to specify exact counts.
{n}: Matches exactly n times.
{n,}: Matches n or more times.
{n,m}: Matches between n and
m times.
Brackets ([abc]):
Matches any single character inside the brackets.
Negated Brackets ([^abc]):
Matches any single character
not inside the brackets.
Range ([a-z]):
Matches any single character in the specified
range.
Shorthand Classes:
\d: Matches any digit.
(Same as [0-9])
\w: Matches any word character.
(Same as [a-zA-Z0-9_])
\s: Matches any whitespace character.
Negated Shorthands:
\D: Matches any non-digit.
\W: Matches any non-word character.
\S: Matches any non-whitespace character.
Caret (^):
Matches
the start of the string.
Dollar Sign ($):
Matches the end of the string.
Word Boundary (\b):
Matches the position between a word character and
a non-word character.
Parentheses ((...)):
Groups part of the expression together and
captures the match.
Pipe (|):
Acts as an
OR operator.
(e.g., cat|dog matches "cat" or
"dog")
Backslash (\):
Escapes a special character to treat it as a
literal.
(e.g., use \. to match a literal
dot)