liveBook · Manning

Re

The re module is Python’s standard-library module for compiling and applying regular expressions to text.

How 2 Manning books explain it

Tiny Python Projects: Learn coding and testing with puzzles and games

re is Python's standard-library module for matching and manipulating text with regular expressions.

How it is used
Uses regular-expression patterns to match, substitute, and split text when direct string methods become cumbersome.
How deep it goes
Introduces character classes, repetition, matching position, substitution, and splitting, but deliberately scratches only the surface of regexes.
Examples
Demonstrates vowel replacement, initial-consonant matching, and comma-based splitting.
What you can do after
Apply it via Python’s re module to replace matched text, detect patterns at chosen positions, and split text with regex delimiters.

Read how Tiny Python Projects: Learn coding and testing with puzzles and games explains re →

The Quick Python Book, Fourth Edition

re is Python's standard-library module for matching and processing text with regular expressions.

How it is used
Handles flexible text searching, pattern extraction, replacement, splitting, and recognition beyond literal substring operations.
How deep it goes
Explains patterns, compilation, search results, raw strings, replacements, flags, and match processing without detailing every special character.
Examples
Uses whitespace normalization and line counting for text containing the word hello.
What you can do after
Apply re.compile, search, and sub to detect patterns, inspect matches, count matching lines, and normalize text.

Read how The Quick Python Book, Fourth Edition explains re →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.