28 Regular Expressions
The re module of the standard library provides extensive options for using regular expressions. In a regular expression, a text pattern is described by a special syntax, which can then be applied to different texts or text fragments. Basically, there are two major areas of use for regular expressions:
-
Matching checks whether a text section matches the regular expression pattern. For example, a test that checks whether an entered email address is syntactically valid is performing matching.
-
The second possible use of regular expressions is searching, which searches for text fragments within a larger text that match a regular expression.
Searching is a discipline in its own right; this behavior can’t be efficiently implemented ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access