Skip to main content
HomePython

Course

Regular Expressions in Python

BasicSkill Level
4.7+
174 reviews
Updated 03/2026
Learn about string manipulation and become a master at using regular expressions.
Start Course for Free
PythonProgramming4 hr15 videos54 Exercises4,650 XP48,539Statement of Accomplishment

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.

Loved by learners at thousands of companies

Group

Training 2 or more people?

Try DataCamp for Business

Course Description

As a data scientist, you will encounter many situations where you will need to extract key information from huge corpora of text, clean messy data containing strings, or detect and match patterns to find useful words. All of these situations are part of text mining and are an important step before applying machine learning algorithms. This course will take you through understanding compelling concepts about string manipulation and regular expressions. You will learn how to split strings, join them back together, interpolate them, as well as detect, extract, replace, and match strings using regular expressions. On the journey to master these skills, you will work with datasets containing movie reviews or streamed tweets that can be used to determine opinion, as well as with raw text scraped from the web.

Prerequisites

Intermediate Python
1

Basic Concepts of String Manipulation

Start your journey into the regular expression world! From slicing and concatenating, adjusting the case, removing spaces, to finding and replacing strings. You will learn how to master basic operation for string manipulation using a movie review dataset.
Start Chapter
2

Formatting Strings

Following your journey, you will learn the main approaches that can be used to format or interpolate strings in python using a dataset containing information scraped from the web. You will explore the advantages and disadvantages of using positional formatting, embedding expressing inside string constants, and using the Template class.
Start Chapter
3

Regular Expressions for Pattern Matching

Time to discover the fundamental concepts of regular expressions! In this key chapter, you will learn to understand the basic concepts of regular expression syntax. Using a real dataset with tweets meant for sentiment analysis, you will learn how to apply pattern matching using normal and special characters, and greedy and lazy quantifiers.
Start Chapter
4

Advanced Regular Expression Concepts

In the last step of your journey, you will learn more complex methods of pattern matching using parentheses to group strings together or to match the same text as matched previously. Also, you will get an idea of how you can look around expressions.
Start Chapter
Regular Expressions in Python
Course
Complete

Earn Statement of Accomplishment

Add this credential to your LinkedIn profile, resume, or CV
Share it on social media and in your performance review
Enroll Now

Don’t just take our word for it

*4.7
from 174 reviews
80%
16%
3%
0%
0%
  • Jules
    19 hours ago

  • Artur
    6 days ago

  • Adebisi
    last week

  • Jojit
    last week

  • Witali
    2 weeks ago

  • Szymon
    3 weeks ago

Jules

Artur

Jojit

FAQs

Is prior experience with regular expressions needed to take this course?

No. The course starts with basic string manipulation like slicing and concatenating, then builds up to regular expression syntax. Familiarity with Intermediate Python is sufficient.

What real datasets are used to practice pattern matching?

You will work with a movie review dataset for string manipulation and a collection of streamed tweets used for sentiment analysis to practice regular expression techniques.

Which Python string formatting methods does this course compare?

The course covers positional formatting, f-strings for embedding expressions inside string constants, and the Template class, comparing the advantages and disadvantages of each.

What advanced regex topics are included beyond basic matching?

You will learn grouping with parentheses, backreferences to match previously captured text, lookahead and lookbehind assertions, and greedy versus lazy quantifiers.

How would these regex skills apply in a data science workflow?

Regular expressions are essential for cleaning messy text data, extracting structured fields from unstructured sources, and preparing corpora for natural language processing pipelines.

Join over 19 million learners and start Regular Expressions in Python today!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.

Grow your data skills with DataCamp for Mobile

Make progress on the go with our mobile courses and daily 5-minute coding challenges.