2 Python Regular Expression Patterns List
2 Python Regular Expression Patterns List
The following table lists the regular expression syntax that is available in
Python. Note that any Regex can be concatenated to form new regular
expressions; if X and Y are both regular expressions, then XY is also a
regular expression.
Pattern Description
brackets.
Matches 0 or 1 occurrence of
?
preceding expression.
x| y Matches either x or y .
\D Matches nondigits.
\s Matches whitespace.
\S Matches nonwhitespace.
Pattern Description
(?#...) Comment.