summaryrefslogtreecommitdiffstats
path: root/Doc/lib
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-09-24 03:41:05 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-09-24 03:41:05 (GMT)
commit596ba4d89e139efbac86a3254aa1d3653f1382ee (patch)
tree05bfa5a04952924b6f5269e3737221b3e0383eb2 /Doc/lib
parent9fa544cfa3a8f124fa4e88481ba0b60406e0caed (diff)
downloadcpython-596ba4d89e139efbac86a3254aa1d3653f1382ee.zip
cpython-596ba4d89e139efbac86a3254aa1d3653f1382ee.tar.gz
cpython-596ba4d89e139efbac86a3254aa1d3653f1382ee.tar.bz2
Granted Noam Raphael's request for minor improvements to the re module and
its documentation. * Documented that the compiled re methods are supposed to be more full featured than their simpilified function counterparts. * Documented the existing start and stop position arguments for the findall() and finditer() methods of compiled regular expression objects. * Added an optional flags argument to the re.findall() and re.finditer() functions. This aligns their API with that for re.search() and re.match().
Diffstat (limited to 'Doc/lib')
-rw-r--r--Doc/lib/libre.tex18
1 files changed, 12 insertions, 6 deletions
diff --git a/Doc/lib/libre.tex b/Doc/lib/libre.tex
index 704db30..0d9b702 100644
--- a/Doc/lib/libre.tex
+++ b/Doc/lib/libre.tex
@@ -424,8 +424,10 @@ re.compile("^a", re.M).search("ba", 1) # fails; no preceding \n
\subsection{Module Contents}
\nodename{Contents of Module re}
-The module defines the following functions and constants, and an exception:
-
+The module defines several functions, constants, and an exception. Some of the
+functions are simplified versions of the full featured methods for compiled
+regular expressions. Most non-trivial applications always use the compiled
+form.
\begin{funcdesc}{compile}{pattern\optional{, flags}}
Compile a regular expression pattern into a regular expression
@@ -552,21 +554,23 @@ ignored.
the old \function{regsub.split()} and \function{regsub.splitx()}.
\end{funcdesc}
-\begin{funcdesc}{findall}{pattern, string}
+\begin{funcdesc}{findall}{pattern, string\optional{, flags}}
Return a list of all non-overlapping matches of \var{pattern} in
\var{string}. If one or more groups are present in the pattern,
return a list of groups; this will be a list of tuples if the
pattern has more than one group. Empty matches are included in the
result unless they touch the beginning of another match.
\versionadded{1.5.2}
+ \versionchanged[Added the optional flags argument]{2.4}
\end{funcdesc}
-\begin{funcdesc}{finditer}{pattern, string}
+\begin{funcdesc}{finditer}{pattern, string\optional{, flags}}
Return an iterator over all non-overlapping matches for the RE
\var{pattern} in \var{string}. For each match, the iterator returns
a match object. Empty matches are included in the result unless they
touch the beginning of another match.
\versionadded{2.2}
+ \versionchanged[Added the optional flags argument]{2.4}
\end{funcdesc}
\begin{funcdesc}{sub}{pattern, repl, string\optional{, count}}
@@ -695,11 +699,13 @@ attributes:
Identical to the \function{split()} function, using the compiled pattern.
\end{methoddesc}
-\begin{methoddesc}[RegexObject]{findall}{string}
+\begin{methoddesc}[RegexObject]{findall}{string\optional{, pos\optional{,
+ endpos}}}
Identical to the \function{findall()} function, using the compiled pattern.
\end{methoddesc}
-\begin{methoddesc}[RegexObject]{finditer}{string}
+\begin{methoddesc}[RegexObject]{finditer}{string\optional{, pos\optional{,
+ endpos}}}
Identical to the \function{finditer()} function, using the compiled pattern.
\end{methoddesc}