The re Pattern-Matching Module
re module is the standard regular
expression-matching interface. Regular expression (RE) patterns are
specified as strings. This module must be imported.
compile(pattern [, flags])
Compile an RE
patternstring into a regular expression object, for later matching.
flags(combinable by bitwise
|operator) include the following available at the top-level of the
\Sperform ASCII-only matching instead of full Unicode matching. This is only meaningful for Unicode patterns and is ignored for byte patterns. Note that for backward compatibility, the
re.Uflag still exists (as well as its synonym
re.UNICODEand its embedded counterpart,
?u), but these are redundant in Python 3.0 since matches are Unicode by default for strings (and Unicode matching isn’t allowed for bytes).
\Ddependent on the current locale (default is Unicode for Python 3).
Matches to each newline, not whole string.
.matches all characters, including newline.
\Ddependent on Unicode character properties (new in version 2.0, and superfluous in Python 3).
Ignores whitespace in the pattern, outside character sets.
match(pattern, string [, flags])
If zero or more characters at start of
stringmatch the ...