mirror of
https://github.com/python/cpython.git
synced 2026-01-04 14:32:21 +00:00
- Included examples documenting how the lastindex member of
match objects work.
This commit is contained in:
parent
334df6c597
commit
cf146d31e7
1 changed files with 9 additions and 5 deletions
|
|
@ -823,16 +823,20 @@ The value of \var{endpos} which was passed to the
|
|||
into the string beyond which the RE engine will not go.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[MatchObject]{lastindex}
|
||||
The integer index of the last matched capturing group, or \code{None}
|
||||
if no group was matched at all. For example, the expressions
|
||||
\regexp{(a)b}, \regexp{((a)(b))}, and \regexp{((ab))} will have
|
||||
\code{lastindex == 1} if applyied to the string \code{'ab'},
|
||||
while the expression \regexp{(a)(b)} will have \code{lastindex == 2},
|
||||
if applyied to the same string.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[MatchObject]{lastgroup}
|
||||
The name of the last matched capturing group, or \code{None} if the
|
||||
group didn't have a name, or if no group was matched at all.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[MatchObject]{lastindex}
|
||||
The integer index of the last matched capturing group, or \code{None}
|
||||
if no group was matched at all.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[MatchObject]{re}
|
||||
The regular expression object whose \method{match()} or
|
||||
\method{search()} method produced this \class{MatchObject} instance.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue