summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libre.tex
diff options
context:
space:
mode:
authorGustavo Niemeyer <gustavo@niemeyer.net>2003-04-20 01:48:59 (GMT)
committerGustavo Niemeyer <gustavo@niemeyer.net>2003-04-20 01:48:59 (GMT)
commitcf146d31e72467db55a97169563c813706cef681 (patch)
tree82f1e4b48f6d2a7ff16970890e5ddb44c35315c9 /Doc/lib/libre.tex
parent334df6c597951fcb5c67b249540c420371b36bdc (diff)
downloadcpython-cf146d31e72467db55a97169563c813706cef681.zip
cpython-cf146d31e72467db55a97169563c813706cef681.tar.gz
cpython-cf146d31e72467db55a97169563c813706cef681.tar.bz2
- Included examples documenting how the lastindex member of
match objects work.
Diffstat (limited to 'Doc/lib/libre.tex')
-rw-r--r--Doc/lib/libre.tex14
1 files changed, 9 insertions, 5 deletions
diff --git a/Doc/lib/libre.tex b/Doc/lib/libre.tex
index 002af7e..c2c7a6f 100644
--- a/Doc/lib/libre.tex
+++ b/Doc/lib/libre.tex
@@ -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.