0Pricing
Python Academy · Lesson

Regex Fundamentals

Learn metacharacters, character classes, quantifiers, and anchors.

Introduction

Regular expressions are patterns for matching text. Python's re module provides the tools to use them.

What is a Regex?

A regex is a sequence of characters forming a search pattern. r'\d+' matches one or more digits.
import re
print(re.findall(r'\d+', 'abc 123 def 456'))

All lessons in this course

  1. Regex Fundamentals
  2. Using re.match, re.search, re.findall
  3. Groups and Named Captures
  4. re.sub, Flags, and Compiled Patterns
← Back to Python Academy