In the first two parts of this series, we looked at some fairly advanced usage of regular expressions. In this part, we take a step back and look at some of the other functions Python offers in the re module, then we talk about some common mistakes people regularly (ha!) make. Useful Python Regular Expression […]
Articles Tagged: re.search
In the first part of this series, we looked at the basic syntax of regular expressions and some simple examples. In this part, we’ll take a look at some more advanced syntax and a few of the other features Python has to offer. Regular Expression Captured Groups So far, we’ve searched within a string using […]
Searching within a string for another string is pretty easy in Python:
>>> str = 'Hello, world'
This is fine if we know exactly what we’re looking for, but what if we’re looking for something not so well-defined? For example, if we want to search for a year, then we know it’s going to be a 4-digit sequence, but […]