@@ -490,18 +490,20 @@ \subsection{Match Objects}
490490
491491\code {MatchObject} instances support the following methods and attributes:
492492
493- \begin {funcdesc }{group}{\optional {g1, g2 , ...}}
494- Returns one or more groups of the match. If there is a single
495- \var {index} argument, the result is a single string; if there are
493+ \begin {funcdesc }{group}{\optional {group1, group2 , ...}}
494+ Returns one or more subgroups of the match. If there is a single
495+ argument, the result is a single string; if there are
496496multiple arguments, the result is a tuple with one item per argument.
497- If the \var {index} is zero, the corresponding return value is the
497+ Without arguments, \var {group1} defaults to zero (i.e. the whole match
498+ is returned).
499+ If a \var {groupN} argument is zero, the corresponding return value is the
498500entire matching string; if it is in the inclusive range [1..99], it is
499501the string matching the the corresponding parenthesized group. If no
500502such group exists, the corresponding result is
501503\code {None}.
502504
503505If the regular expression uses the \code {(?P<\var {name}>...)} syntax,
504- the \var {index } arguments may also be strings identifying groups by
506+ the \var {groupN } arguments may also be strings identifying groups by
505507their group name.
506508
507509A moderately complicated example:
@@ -511,7 +513,7 @@ \subsection{Match Objects}
511513\end {verbatim }
512514
513515After performing this match, \code {m.group(1)} is \code {'3'}, as is
514- \code {m.group('int')}. \code {m.group(2)} is \code {'14'}.
516+ \code {m.group('int')}, and \code {m.group(2)} is \code {'14'}.
515517\end {funcdesc }
516518
517519\begin {funcdesc }{groups}{}
@@ -523,12 +525,14 @@ \subsection{Match Objects}
523525singleton tuple is returned in such cases.)
524526\end {funcdesc }
525527
526- \begin {funcdesc }{start}{group}
528+ \begin {funcdesc }{start}{\optional { group} }
527529\end {funcdesc }
528530
529- \begin {funcdesc }{end}{group}
531+ \begin {funcdesc }{end}{\optional { group} }
530532Return the indices of the start and end of the substring
531- matched by \var {group}. Return \code {None} if \var {group} exists but
533+ matched by \var {group}; \var {group} defaults to zero (meaning the whole
534+ matched substring).
535+ Return \code {None} if \var {group} exists but
532536did not contribute to the match. For a match object
533537\var {m}, and a group \var {g} that did contribute to the match, the
534538substring matched by group \var {g} (equivalent to
@@ -548,11 +552,11 @@ \subsection{Match Objects}
548552
549553\end {funcdesc }
550554
551- \begin {funcdesc }{span}{group}
555+ \begin {funcdesc }{span}{\optional { group} }
552556For \code {MatchObject} \var {m}, return the 2-tuple
553557\code {(\var {m}.start(\var {group}), \var {m}.end(\var {group}))}.
554558Note that if \var {group} did not contribute to the match, this is
555- \code {(None, None)}.
559+ \code {(None, None)}. Again, \var {group} defaults to zero.
556560\end {funcdesc }
557561
558562\begin {datadesc }{pos}
0 commit comments