]> granicus.if.org Git - python/commitdiff
- Included examples documenting how the lastindex member of
authorGustavo Niemeyer <gustavo@niemeyer.net>
Sun, 20 Apr 2003 01:48:59 +0000 (01:48 +0000)
committerGustavo Niemeyer <gustavo@niemeyer.net>
Sun, 20 Apr 2003 01:48:59 +0000 (01:48 +0000)
  match objects work.

Doc/lib/libre.tex

index 002af7ea18fa91a2aabf62f29921ff0db2c89dd0..c2c7a6fd13c38d2548fd77a05e57fce099e5e5bf 100644 (file)
@@ -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.