Regular Expressions and Building Regexes in Python

Christopher Trudeau
Christopher Trudeau 14 Lessons 1h 53m basics python

In this course, you’ll explore regular expressions, also known as regexes, in Python. A regex is a special sequence of characters that defines a pattern for complex string-matching functionality.

String matching like this is a common task in programming, and you can get a lot done with string operators and built-in methods. At times, though, you may need more sophisticated pattern-matching capabilities.

In this course, you’ll learn:

  • How to access the re module, which implements regex matching in Python
  • How to use re.search() to match a pattern against a string
  • How to create complex matching pattern with regex metacharacters
  • Explore more functions, beyond re.search(), that the re module provides
  • Learn when and how to precompile a regex in Python into a regular expression object
  • Discover useful things that you can do with the match object returned by the functions in the re module

What’s Included:

Downloadable Resources:

Related Learning Paths:

About Christopher Trudeau

Christopher has a passion for the Python language and writes, records, and podcasts for Real Python. He is a consultant who helps advise organizations on how to improve their technical teams.

» More about Christopher

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Participant Comments

Avatar image for aniketbarphe

aniketbarphe

Great Course! Thank You!

Avatar image for Shubha

Shubha

Great Course! Enjoyed learning lots of new stuff using regex. Thank you.

Avatar image for datagirl-89

datagirl-89

This was a great course and I learned a lot. I used it to complete some assignments in another regex module on Coursera that didn’t provide the instruction I needed to fully understand the concepts. I would have liked a few examples of re.finditer() and when to use that. Otherwise, it was outstanding. Thanks!!

Avatar image for nullrealpython

nullrealpython

Christopher, your clarification of what multiline mode means may well have launched my career. Thanks! Whatever we are paying you… it ain’t enough.

Avatar image for Dirk

Dirk

Thank you for the good course. Everything well to the point. Will help me in my work.

Avatar image for Cici Du

Cici Du

Great course! I have struggled to apply regex after my first 2 courses in Python, so I took this course specifically for regex. This course explains things thoroughly!

Avatar image for raulfz

raulfz

Excellent course, it was really helpful to see how regex are used in the python standard library.

Avatar image for Ghani

Ghani

Excellent course! I like very much the review at the start of each new lesson. Well-done and thanks.

← Browse All Courses

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy