O'Reilly logo

Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython by Richard Hightower

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Metacharacters

The Python metacharacters, or special characters and sequences, are listed and described in Tables xref linkend="app05table02" remap="E–2"/> and E-3.

Table E-2. Python Metacharacters (Single Characters)
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") ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required