any character
.
zero or more
*
one or more
+
whitespace (space, newline, tab)
\s
two characters
\w{2}
search for match
re. search(pattern, string) # at most one match
re. findall(pattern, string) # list of matches
get first tuple from re.search
re.search(pattern, string).group(1) # 0 is full match
beginning of line or string
end of line or string
$
all uppercase letters
[A-Z]
a, b or c
[abc]
not b
[^b]
not lowercase letters
[^a-z]
neither n or o
[^no]
this or that
(this|that)
any word character
\w
[a-zA-Z0-9_]
any digit
\d
any non-word character
\W
any non-digit
\D
any non-whitespace character
\S
word boundary
\b (not inside [])
no word boundary
\B
special characters that need quoting
. | [ ( * ^ / { ?
optional minus-sign
-?