June 2000
Intermediate to advanced
556 pages
8h 45m
English
The Python standard library provides a module known as re for regular expression processing. For full information on re, see the documentation at Doc\lib\module-re.html. Also, a “how to guide” to regular expressions can be found at http://www.python.org/doc/howto/.
The simplest way to use the re module is to use the search function. It takes two parameters—the pattern and the string to be searched. If the search succeeds, the function returns an object known as a match object. If it fails, it returns None. Every match object provides methods called start() and end() that can be used to retrieve the start and end offsets of the matching string, respectively.
CD-ROM reference=7047.txt >>> import re >>> # Search ...
Read now
Unlock full access