Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Regular expressions are a very powerful method for matching patterns in text. Regular expressions are used for a variety of purposes, from simple search and replace operations to complex text and data file manipulation. Regular expressions are actually a small language in itself. Regular expressions can be very simple or they can be very complex. Entire books have been written on the subject of regular expressions. If you are moderately familiar with how they work and what they look like, you can get a lot of power out of them using Python's regular expression module.
Regular expressions are implemented in Python with the re module. This is Python's regular expression module and it's distributed with Python. So if you have Python, you have the re module. How it works looks like this. You import re and you compile a pattern and then you use the pattern to search and replace or to perform whatever manipulations you are going to perform using the regular expressions. So let's go ahead and look at how we use regular expressions in Python.
Get unlimited access to all courses for just $25/month.Become a member