MISSION 354

Regular Expression Basics

In this Regular Expression Basics mission, you will learn what regular expressions (regex) are and how you can use them to do some advanced data cleaning in Python.

We'll cover the fundamentals of regular expressions and how they can be used for more powerful string manipulation. You'll learn about regex concepts such as character classes, quantifiers, capture groups, positional anchors, and more. Then you'll learn about how to make use of regular expressions in Python using the re module. This module allows you to easily perform regex operations like searching and replacing text patterns with other text patterns directly in your Python code.

In this mission, you will be working with text data from Hacker News, which will give you plenty of practice using regular expressions to tidy up messy text for analysis. You'll get the opportunity to think like a data scientist as you explore this data set, and by the end of the mission, you will have a working knowledge of regular expressions and how to use them to do powerful string manipulation. 

In addition to this mission, you can also check out our Regular Expressions tutorial for extra practice or as a supplementary learning resource!

Objectives

  • Learn what regular expressions are and how to use them.
  • Learn regex compnents like character classes and quantifiers.
  • Learn how to use Regular Expressions with the 're' module and pandas.

Mission Outline

1. Introduction
2. The Regular Expression Module
3. Counting Matches with pandas Methods
4. Using Regular Expressions to Select Data
5. Quantifiers
6. Character Classes
7. Accessing the Matching Text with Capture Groups
8. Negative Character Classes
9. Word Boundaries
10. Matching at the Start and End of Strings
11. Challenge: Using Flags to Modify Regex Patterns
12. Next Steps
13. Takeaways

python-data-cleaning-advanced

Course Info:

Intermediate

The median completion time for this course is 7 hours. View Details

This course requires a basic subscription and includes four missions. It is the sixth course in the Data Analyst in Python Path and Data Scientist in Python Path

START LEARNING FREE

Take a Look Inside