Implementing Python-specific elements
Up until now, most of the regular expression information we've covered has been Python-agnostic (with the exception of the
(?P…) patterns). Now, let's take a look at some of the more Python-specific elements.
Other search functions
In addition to the
re.match function we've been using, Python also makes a few other methods available to us. The big limitation on the
match function is that it will only match at the beginning of a string. Here's a quick survey of the other available methods. We'll outline the following methods:
search function will match anywhere within a string and is not limited to the beginning. While it is possible to construct
re.match regular expressions ...