September 2026
1051 pages
35h 4m
English
Having described the syntax of regular expressions in greater detail, we’ll now look at their actual usage in Python. The examples in the following sections will be implemented in interactive mode and are based on the assumption that the re module has already been imported:
>>> import re
The functions presented in the following sections allow you to pass a set of settings via the optional last flags parameter, which enables you to influence the evaluation of the regular expressions. For more information on flags, Section 28.2.7.
The search function is passed a pattern regular expression and a string string:
search(pattern, string, [flags])
It then returns the first substring of string
Read now
Unlock full access