October 2018
Beginner to intermediate
466 pages
12h 2m
English
Let's now focus on the Python side of things. The regular expression syntax is the furthest thing from object-oriented programming. However, Python's re module provides an object-oriented interface to enter the regular expression engine.
We've been checking whether the re.match function returns a valid object or not. If a pattern does not match, that function returns None. If it does match, however, it returns a useful object that we can introspect for information about the pattern.
So far, our regular expressions have answered questions such as, does this string match this pattern? Matching patterns is useful, but in many cases, a more interesting question is, if this string matches this pattern, ...