Name
group
Synopsis
m
.group(groupid
=0,*groupids
)
When called with a single argument groupid
(a group number or name), group
returns the
substring matching the group identified by
groupid
, or None
if
that group did not participate in the match. The common idiom
m
.group( )
, also
spelled m
.group(0)
,
returns the whole matched substring, since group number
0
implicitly means the whole regular expression.
When group
is called with multiple arguments, each
argument must be a group number or name. group
then returns a tuple with one item per argument, the substring
matching the corresponding group, or None
if that
group did not participate in the match.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.