liveBook · Manning

Group

group() is a regular-expression match-object method that returns the complete match or the text captured by a specified capturing group.

How 2 Manning books explain it

The Quick Python Book, Fourth Edition

group is a match-object method that retrieves the substring captured by a specified regular-expression group.

How it is used
Retrieves captured fields from regex matches for record parsing and replacement functions.
How deep it goes
Works through named-group syntax, match checking, optional captures, and callback retrieval; does not detail match-object internals.
Examples
Uses a surname-and-phone record parser and a number-to-decimal-string replacement.
What you can do after
Apply it via Python’s `re` module to extract named fields and construct replacement strings from matches.

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

Python How-To

A group method is a regular-expression match operation that returns the substring captured by specified groups or the complete match when no group number is supplied.

How it is used
Retrieves complete matches or selected captured fields for downstream text processing.
How deep it goes
Explains complete, numbered, and named retrieval through worked examples, while warning that positional numbering becomes error-prone.
Examples
Demonstrates extracting words from a phrase and task IDs, titles, and descriptions from structured text.
What you can do after
Apply Python's regular-expression Match API to retrieve complete, numbered, or named captured text.

Read how Python How-To explains group →

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.