Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cf146d3

Browse files
committed
- Included examples documenting how the lastindex member of
match objects work.
1 parent 334df6c commit cf146d3

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

Doc/lib/libre.tex

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -823,16 +823,20 @@ \subsection{Match Objects \label{match-objects}}
823823
into the string beyond which the RE engine will not go.
824824
\end{memberdesc}
825825

826+
\begin{memberdesc}[MatchObject]{lastindex}
827+
The integer index of the last matched capturing group, or \code{None}
828+
if no group was matched at all. For example, the expressions
829+
\regexp{(a)b}, \regexp{((a)(b))}, and \regexp{((ab))} will have
830+
\code{lastindex == 1} if applyied to the string \code{'ab'},
831+
while the expression \regexp{(a)(b)} will have \code{lastindex == 2},
832+
if applyied to the same string.
833+
\end{memberdesc}
834+
826835
\begin{memberdesc}[MatchObject]{lastgroup}
827836
The name of the last matched capturing group, or \code{None} if the
828837
group didn't have a name, or if no group was matched at all.
829838
\end{memberdesc}
830839

831-
\begin{memberdesc}[MatchObject]{lastindex}
832-
The integer index of the last matched capturing group, or \code{None}
833-
if no group was matched at all.
834-
\end{memberdesc}
835-
836840
\begin{memberdesc}[MatchObject]{re}
837841
The regular expression object whose \method{match()} or
838842
\method{search()} method produced this \class{MatchObject} instance.

0 commit comments

Comments
 (0)