8.12 Introduction to Regular Expressions

Sometimes you’ll need to recognize patterns in text, like phone numbers, e-mail addresses, ZIP Codes, web page addresses, Social Security numbers and more. A regular expression string describes a search pattern for matching characters in other strings.

Regular expressions can help you extract data from unstructured text, such as social media posts. They’re also important for ensuring that data is in the correct format before you attempt to process it.3

Get Intro to Python for Computer Science and Data Science: Learning to Program with AI, Big Data and The Cloud now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.