June 2002
Beginner to intermediate
640 pages
14h 24m
English
The Python metacharacters, or special characters and sequences, are listed and described in Tables xref linkend="app05table02" remap="E–2"/> and E-3.
| Metacharacter | Behavior | Example |
|---|---|---|
| “.” | Matches any character except a newline, by default. If the DOTALL flag has been specified, this matches any character, including a newline. |
search(".B","AB")
returns a match object
search(".B","A\nB")
returns None
|
| “^” | Matches at the beginning of a string and, if the MULTILINE flag is used, also matches immediately after each newline. Used as the first character of the expression or group to match at the beginning of a string. |
search("^cat","cats") returns a match object search("^cat","a cat") ... |
Read now
Unlock full access