The re module is used to perform regular-expression pattern matching and replacement in strings. Both ordinary and Unicode strings are supported. Regular-expression patterns are specified as strings containing a mix of text and special-character sequences. Because patterns often make extensive use of special characters and the backslash, they’re usually written as “raw” strings, such as r'(?P<int>\d+)\.(\d*)'. For the remainder of this section, all regular-expression patterns are denoted using the raw string syntax.
The following special-character sequences are recognized in regular expression patterns:
|text||Matches the literal string text.|
|.||Matches any character except newline.|
|^||Matches the start of a string.|
|$||Matches the ...|