Python re module: patterns, groups, search and replace

10 steps · about 4 h 20 min · Beginner

  1. RegexOne - Learn Regular Expressions - Lesson 1: An Introduction, and the ABCs (interactive, RegexOne, 45 min)

    Start with language-neutral pattern basics (characters, ranges, quantifiers, groups) in short, graded exercises before touching Python.

  2. Python Regex: How to Use re.search, re.match, and re.findall (article, AppSignal Blog, 15 min)

    Your first Python code: raw strings and the core search, match and sub calls, with short runnable examples.

  3. Regular Expression in Python (guide, PyNative, 25 min)

    A compact table of the re functions (search, match, findall, finditer, split, sub) to compare side by side.

  4. Regular expression HOWTO (doc, Python documentation, 40 min)

    The official, gentler-than-reference tutorial covering compiling patterns, match objects, groups and substitution.

  5. Python re Module - Use Regular Expressions with Python - Regex Support (reference, regular-expressions.info, 15 min)

    Clears up the classic confusions: search vs match, flags like IGNORECASE and MULTILINE, and backslash rules in replacements.

  6. Working with matched portions - Understanding Python re(gex)? (tutorial, learnbyexample, 30 min)

    Shows how findall, finditer and Match objects behave with and without capture groups, with exercises.

  7. Python Regex Groups: How to Extract All Matching Groups from a String Using Regular Expressions (article, py4u, 15 min)

    Builds on groups with non-capturing groups, groupdict() and why findall returns tuples.

  8. Python Regex Named Groups - Be on the Right Side of Change (blog, Finxter, 15 min)

    Makes patterns self-documenting with (?P<name>...), including optional and repeated named groups.

  9. Python Regex: Regular Expressions with the re Module (guide, PythonGuides, 30 min)

    Pulls it together with flags including VERBOSE, compiled patterns and a syntax cheat sheet for real parsing tasks.

  10. regex101: Online Regex Tester, Builder, Converter & Debugger (interactive, regex101, 30 min)

    Finish by testing your own Python-flavour patterns, inspecting every group and debugging mismatches live.