Commit 013ad986 authored by Fred Drake's avatar Fred Drake

Cleaned up some remaining markup nits.

Andrew:  In description of (?iLmsx), you say it matches the empty string and
sets the corresponding flag.  Is this correct?  Or does it only set the flag?
parent 8fab8cf2
...@@ -265,7 +265,7 @@ The module defines the following functions and constants, and an exception: ...@@ -265,7 +265,7 @@ The module defines the following functions and constants, and an exception:
\setindexsubitem{(in module re)} \setindexsubitem{(in module re)}
\begin{funcdesc}{compile}{pattern\optional{\, flags}} \begin{funcdesc}{compile}{pattern\optional{, flags}}
Compile a regular expression pattern into a regular expression Compile a regular expression pattern into a regular expression
object, which can be used for matching using its \function{match()} and object, which can be used for matching using its \function{match()} and
\function{search()} methods, described below. \function{search()} methods, described below.
...@@ -274,23 +274,20 @@ The module defines the following functions and constants, and an exception: ...@@ -274,23 +274,20 @@ The module defines the following functions and constants, and an exception:
\var{flags} value. Values can be any of the following variables, \var{flags} value. Values can be any of the following variables,
combined using bitwise OR (the \code{|} operator). combined using bitwise OR (the \code{|} operator).
\begin{description} \begin{datadesc}{I}
\dataline{IGNORECASE}
% The use of \quad in the item labels is ugly but adds enough space
% to the label that it doesn't get visually run-in with the text.
\item[\constant{I} or \constant{IGNORECASE} or \code{(?i)}\quad]
Perform case-insensitive matching; expressions like \code{[A-Z]} will match Perform case-insensitive matching; expressions like \code{[A-Z]} will match
lowercase letters, too. This is not affected by the current locale. lowercase letters, too. This is not affected by the current locale.
\end{datadesc}
\item[\constant{L} or \constant{LOCALE} or \constant{(?L)}\quad] \begin{datadesc}{L}
\dataline{LOCALE}
Make \code{\e w}, \code{\e W}, \code{\e b}, Make \code{\e w}, \code{\e W}, \code{\e b},
\code{\e B}, dependent on the current locale. \code{\e B}, dependent on the current locale.
\end{datadesc}
\item[\constant{M} or \constant{MULTILINE} or \constant{(?m)}\quad] \begin{datadesc}{M}
\dataline{MULTILINE}
When specified, the pattern character \code{\^} matches at the When specified, the pattern character \code{\^} matches at the
beginning of the string and at the beginning of each line beginning of the string and at the beginning of each line
(immediately following each newline); and the pattern character (immediately following each newline); and the pattern character
...@@ -299,30 +296,32 @@ beginning of the string and at the beginning of each line ...@@ -299,30 +296,32 @@ beginning of the string and at the beginning of each line
By default, \code{\^} matches only at the beginning of the string, and By default, \code{\^} matches only at the beginning of the string, and
\code{\$} only at the end of the string and immediately before the \code{\$} only at the end of the string and immediately before the
newline (if any) at the end of the string. newline (if any) at the end of the string.
\end{datadesc}
\item[\constant{S} or \constant{DOTALL} or \constant{(?s)}\quad] \begin{datadesc}{S}
\dataline{DOTALL}
Make the \code{.} special character any character at all, including a Make the \code{.} special character any character at all, including a
newline; without this flag, \code{.} will match anything \emph{except} newline; without this flag, \code{.} will match anything \emph{except}
a newline. a newline.
\end{datadesc}
\item[\constant{X} or \constant{VERBOSE} or \constant{(?x)}\quad] \begin{datadesc}{X}
\dataline{VERBOSE}
Ignore whitespace within the pattern Ignore whitespace within the pattern
except when in a character class or preceded by an unescaped except when in a character class or preceded by an unescaped
backslash, and, when a line contains a \code{\#} neither in a character backslash, and, when a line contains a \code{\#} neither in a character
class or preceded by an unescaped backslash, all characters from the class or preceded by an unescaped backslash, all characters from the
leftmost such \code{\#} through the end of the line are ignored. leftmost such \code{\#} through the end of the line are ignored.
\end{datadesc}
\end{description}
The sequence The sequence
%
\begin{verbatim} \begin{verbatim}
prog = re.compile(pat) prog = re.compile(pat)
result = prog.match(str) result = prog.match(str)
\end{verbatim} \end{verbatim}
%
is equivalent to is equivalent to
\begin{verbatim} \begin{verbatim}
...@@ -343,7 +342,7 @@ expression will be used several times in a single program. ...@@ -343,7 +342,7 @@ expression will be used several times in a single program.
regular expression metacharacters in it. regular expression metacharacters in it.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{match}{pattern\, string\optional{\, flags}} \begin{funcdesc}{match}{pattern, string\optional{, flags}}
If zero or more characters at the beginning of \var{string} match If zero or more characters at the beginning of \var{string} match
the regular expression \var{pattern}, return a corresponding the regular expression \var{pattern}, return a corresponding
\class{MatchObject} instance. Return \code{None} if the string does not \class{MatchObject} instance. Return \code{None} if the string does not
...@@ -351,7 +350,7 @@ expression will be used several times in a single program. ...@@ -351,7 +350,7 @@ expression will be used several times in a single program.
match. match.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{search}{pattern\, string\optional{\, flags}} \begin{funcdesc}{search}{pattern, string\optional{, flags}}
Scan through \var{string} looking for a location where the regular Scan through \var{string} looking for a location where the regular
expression \var{pattern} produces a match, and return a expression \var{pattern} produces a match, and return a
corresponding \class{MatchObject} instance. corresponding \class{MatchObject} instance.
...@@ -360,7 +359,7 @@ expression will be used several times in a single program. ...@@ -360,7 +359,7 @@ expression will be used several times in a single program.
different from finding a zero-length match at some point in the string. different from finding a zero-length match at some point in the string.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{split}{pattern\, string\, \optional{, maxsplit=0}} \begin{funcdesc}{split}{pattern, string, \optional{, maxsplit\code{ = 0}}}
Split \var{string} by the occurrences of \var{pattern}. If Split \var{string} by the occurrences of \var{pattern}. If
capturing parentheses are used in pattern, then occurrences of capturing parentheses are used in pattern, then occurrences of
patterns or subpatterns are also returned. patterns or subpatterns are also returned.
...@@ -383,7 +382,7 @@ expression will be used several times in a single program. ...@@ -383,7 +382,7 @@ expression will be used several times in a single program.
the old \function{regsub.split()} and \function{regsub.splitx()}. the old \function{regsub.split()} and \function{regsub.splitx()}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{sub}{pattern\, repl\, string\optional{, count=0}} \begin{funcdesc}{sub}{pattern, repl, string\optional{, count\code{ = 0}}}
Return the string obtained by replacing the leftmost non-overlapping Return the string obtained by replacing the leftmost non-overlapping
occurrences of \var{pattern} in \var{string} by the replacement occurrences of \var{pattern} in \var{string} by the replacement
\var{repl}. If the pattern isn't found, \var{string} is returned \var{repl}. If the pattern isn't found, \var{string} is returned
...@@ -404,20 +403,17 @@ The pattern may be a string or a ...@@ -404,20 +403,17 @@ The pattern may be a string or a
regex object; if you need to specify regex object; if you need to specify
regular expression flags, you must use a regex object, or use regular expression flags, you must use a regex object, or use
embedded modifiers in a pattern; e.g. embedded modifiers in a pattern; e.g.
\samp{sub("(?i)b+", "x", "bbbb BBBB")} returns \code{'x x'}.
\begin{verbatim}
sub("(?i)b+", "x", "bbbb BBBB") returns 'x x'.
\end{verbatim}
The optional argument \var{count} is the maximum number of pattern The optional argument \var{count} is the maximum number of pattern
occurrences to be replaced; count must be a non-negative integer, and occurrences to be replaced; count must be a non-negative integer, and
the default value of 0 means to replace all occurrences. the default value of 0 means to replace all occurrences.
Empty matches for the pattern are replaced only when not adjacent to a Empty matches for the pattern are replaced only when not adjacent to a
previous match, so \code{sub('x*', '-', 'abc')} returns '-a-b-c-'. previous match, so \samp{sub('x*', '-', 'abc')} returns \code{'-a-b-c-'}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{subn}{pattern\, repl\, string\optional{, count=0}} \begin{funcdesc}{subn}{pattern, repl, string\optional{, count\code{ = 0}}}
Perform the same operation as \function{sub()}, but return a tuple Perform the same operation as \function{sub()}, but return a tuple
\code{(\var{new_string}, \var{number_of_subs_made})}. \code{(\var{new_string}, \var{number_of_subs_made})}.
\end{funcdesc} \end{funcdesc}
...@@ -425,8 +421,8 @@ Perform the same operation as \function{sub()}, but return a tuple ...@@ -425,8 +421,8 @@ Perform the same operation as \function{sub()}, but return a tuple
\begin{excdesc}{error} \begin{excdesc}{error}
Exception raised when a string passed to one of the functions here Exception raised when a string passed to one of the functions here
is not a valid regular expression (e.g., unmatched parentheses) or is not a valid regular expression (e.g., unmatched parentheses) or
when some other error occurs during compilation or matching. (It is when some other error occurs during compilation or matching. It is
never an error if a string contains no match for a pattern.) never an error if a string contains no match for a pattern.
\end{excdesc} \end{excdesc}
\subsection{Regular Expression Objects} \subsection{Regular Expression Objects}
...@@ -434,7 +430,7 @@ Compiled regular expression objects support the following methods and ...@@ -434,7 +430,7 @@ Compiled regular expression objects support the following methods and
attributes: attributes:
\setindexsubitem{(re method)} \setindexsubitem{(re method)}
\begin{funcdesc}{match}{string\optional{\, pos}\optional{\, endpos}} \begin{funcdesc}{match}{string\optional{, pos}\optional{, endpos}}
If zero or more characters at the beginning of \var{string} match If zero or more characters at the beginning of \var{string} match
this regular expression, return a corresponding this regular expression, return a corresponding
\class{MatchObject} instance. Return \code{None} if the string does not \class{MatchObject} instance. Return \code{None} if the string does not
...@@ -452,7 +448,7 @@ attributes: ...@@ -452,7 +448,7 @@ attributes:
searched for a match. searched for a match.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{search}{string\optional{\, pos}\optional{\, endpos}} \begin{funcdesc}{search}{string\optional{, pos}\optional{, endpos}}
Scan through \var{string} looking for a location where this regular Scan through \var{string} looking for a location where this regular
expression produces a match. Return \code{None} if no expression produces a match. Return \code{None} if no
position in the string matches the pattern; note that this is position in the string matches the pattern; note that this is
...@@ -462,28 +458,28 @@ attributes: ...@@ -462,28 +458,28 @@ attributes:
meaning as for the \method{match()} method. meaning as for the \method{match()} method.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{split}{string\, \optional{, maxsplit=0}} \begin{funcdesc}{split}{string, \optional{, maxsplit\code{ = 0}}}
Identical to the \function{split()} function, using the compiled pattern. Identical to the \function{split()} function, using the compiled pattern.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{sub}{repl\, string\optional{, count=0}} \begin{funcdesc}{sub}{repl, string\optional{, count\code{ = 0}}}
Identical to the \function{sub()} function, using the compiled pattern. Identical to the \function{sub()} function, using the compiled pattern.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{subn}{repl\, string\optional{, count=0}} \begin{funcdesc}{subn}{repl, string\optional{, count\code{ = 0}}}
Identical to the \function{subn()} function, using the compiled pattern. Identical to the \function{subn()} function, using the compiled pattern.
\end{funcdesc} \end{funcdesc}
\setindexsubitem{(regex attribute)} \setindexsubitem{(regex attribute)}
\begin{datadesc}{flags} \begin{datadesc}{flags}
The flags argument used when the regex object was compiled, or 0 if no The flags argument used when the regex object was compiled, or
flags were provided. \code{0} if no flags were provided.
\end{datadesc} \end{datadesc}
\begin{datadesc}{groupindex} \begin{datadesc}{groupindex}
A dictionary mapping any symbolic group names (defined by A dictionary mapping any symbolic group names defined by
\code{?P<\var{id}>}) to group numbers. The dictionary is empty if no \code{(?P<\var{id}>)} to group numbers. The dictionary is empty if no
symbolic groups were used in the pattern. symbolic groups were used in the pattern.
\end{datadesc} \end{datadesc}
...@@ -531,9 +527,7 @@ singleton tuple is returned in such cases.) ...@@ -531,9 +527,7 @@ singleton tuple is returned in such cases.)
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{start}{\optional{group}} \begin{funcdesc}{start}{\optional{group}}
\end{funcdesc} \funcline{end}{\optional{group}}
\begin{funcdesc}{end}{\optional{group}}
Return the indices of the start and end of the substring Return the indices of the start and end of the substring
matched by \var{group}; \var{group} defaults to zero (meaning the whole matched by \var{group}; \var{group} defaults to zero (meaning the whole
matched substring). matched substring).
......
...@@ -265,7 +265,7 @@ The module defines the following functions and constants, and an exception: ...@@ -265,7 +265,7 @@ The module defines the following functions and constants, and an exception:
\setindexsubitem{(in module re)} \setindexsubitem{(in module re)}
\begin{funcdesc}{compile}{pattern\optional{\, flags}} \begin{funcdesc}{compile}{pattern\optional{, flags}}
Compile a regular expression pattern into a regular expression Compile a regular expression pattern into a regular expression
object, which can be used for matching using its \function{match()} and object, which can be used for matching using its \function{match()} and
\function{search()} methods, described below. \function{search()} methods, described below.
...@@ -274,23 +274,20 @@ The module defines the following functions and constants, and an exception: ...@@ -274,23 +274,20 @@ The module defines the following functions and constants, and an exception:
\var{flags} value. Values can be any of the following variables, \var{flags} value. Values can be any of the following variables,
combined using bitwise OR (the \code{|} operator). combined using bitwise OR (the \code{|} operator).
\begin{description} \begin{datadesc}{I}
\dataline{IGNORECASE}
% The use of \quad in the item labels is ugly but adds enough space
% to the label that it doesn't get visually run-in with the text.
\item[\constant{I} or \constant{IGNORECASE} or \code{(?i)}\quad]
Perform case-insensitive matching; expressions like \code{[A-Z]} will match Perform case-insensitive matching; expressions like \code{[A-Z]} will match
lowercase letters, too. This is not affected by the current locale. lowercase letters, too. This is not affected by the current locale.
\end{datadesc}
\item[\constant{L} or \constant{LOCALE} or \constant{(?L)}\quad] \begin{datadesc}{L}
\dataline{LOCALE}
Make \code{\e w}, \code{\e W}, \code{\e b}, Make \code{\e w}, \code{\e W}, \code{\e b},
\code{\e B}, dependent on the current locale. \code{\e B}, dependent on the current locale.
\end{datadesc}
\item[\constant{M} or \constant{MULTILINE} or \constant{(?m)}\quad] \begin{datadesc}{M}
\dataline{MULTILINE}
When specified, the pattern character \code{\^} matches at the When specified, the pattern character \code{\^} matches at the
beginning of the string and at the beginning of each line beginning of the string and at the beginning of each line
(immediately following each newline); and the pattern character (immediately following each newline); and the pattern character
...@@ -299,30 +296,32 @@ beginning of the string and at the beginning of each line ...@@ -299,30 +296,32 @@ beginning of the string and at the beginning of each line
By default, \code{\^} matches only at the beginning of the string, and By default, \code{\^} matches only at the beginning of the string, and
\code{\$} only at the end of the string and immediately before the \code{\$} only at the end of the string and immediately before the
newline (if any) at the end of the string. newline (if any) at the end of the string.
\end{datadesc}
\item[\constant{S} or \constant{DOTALL} or \constant{(?s)}\quad] \begin{datadesc}{S}
\dataline{DOTALL}
Make the \code{.} special character any character at all, including a Make the \code{.} special character any character at all, including a
newline; without this flag, \code{.} will match anything \emph{except} newline; without this flag, \code{.} will match anything \emph{except}
a newline. a newline.
\end{datadesc}
\item[\constant{X} or \constant{VERBOSE} or \constant{(?x)}\quad] \begin{datadesc}{X}
\dataline{VERBOSE}
Ignore whitespace within the pattern Ignore whitespace within the pattern
except when in a character class or preceded by an unescaped except when in a character class or preceded by an unescaped
backslash, and, when a line contains a \code{\#} neither in a character backslash, and, when a line contains a \code{\#} neither in a character
class or preceded by an unescaped backslash, all characters from the class or preceded by an unescaped backslash, all characters from the
leftmost such \code{\#} through the end of the line are ignored. leftmost such \code{\#} through the end of the line are ignored.
\end{datadesc}
\end{description}
The sequence The sequence
%
\begin{verbatim} \begin{verbatim}
prog = re.compile(pat) prog = re.compile(pat)
result = prog.match(str) result = prog.match(str)
\end{verbatim} \end{verbatim}
%
is equivalent to is equivalent to
\begin{verbatim} \begin{verbatim}
...@@ -343,7 +342,7 @@ expression will be used several times in a single program. ...@@ -343,7 +342,7 @@ expression will be used several times in a single program.
regular expression metacharacters in it. regular expression metacharacters in it.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{match}{pattern\, string\optional{\, flags}} \begin{funcdesc}{match}{pattern, string\optional{, flags}}
If zero or more characters at the beginning of \var{string} match If zero or more characters at the beginning of \var{string} match
the regular expression \var{pattern}, return a corresponding the regular expression \var{pattern}, return a corresponding
\class{MatchObject} instance. Return \code{None} if the string does not \class{MatchObject} instance. Return \code{None} if the string does not
...@@ -351,7 +350,7 @@ expression will be used several times in a single program. ...@@ -351,7 +350,7 @@ expression will be used several times in a single program.
match. match.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{search}{pattern\, string\optional{\, flags}} \begin{funcdesc}{search}{pattern, string\optional{, flags}}
Scan through \var{string} looking for a location where the regular Scan through \var{string} looking for a location where the regular
expression \var{pattern} produces a match, and return a expression \var{pattern} produces a match, and return a
corresponding \class{MatchObject} instance. corresponding \class{MatchObject} instance.
...@@ -360,7 +359,7 @@ expression will be used several times in a single program. ...@@ -360,7 +359,7 @@ expression will be used several times in a single program.
different from finding a zero-length match at some point in the string. different from finding a zero-length match at some point in the string.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{split}{pattern\, string\, \optional{, maxsplit=0}} \begin{funcdesc}{split}{pattern, string, \optional{, maxsplit\code{ = 0}}}
Split \var{string} by the occurrences of \var{pattern}. If Split \var{string} by the occurrences of \var{pattern}. If
capturing parentheses are used in pattern, then occurrences of capturing parentheses are used in pattern, then occurrences of
patterns or subpatterns are also returned. patterns or subpatterns are also returned.
...@@ -383,7 +382,7 @@ expression will be used several times in a single program. ...@@ -383,7 +382,7 @@ expression will be used several times in a single program.
the old \function{regsub.split()} and \function{regsub.splitx()}. the old \function{regsub.split()} and \function{regsub.splitx()}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{sub}{pattern\, repl\, string\optional{, count=0}} \begin{funcdesc}{sub}{pattern, repl, string\optional{, count\code{ = 0}}}
Return the string obtained by replacing the leftmost non-overlapping Return the string obtained by replacing the leftmost non-overlapping
occurrences of \var{pattern} in \var{string} by the replacement occurrences of \var{pattern} in \var{string} by the replacement
\var{repl}. If the pattern isn't found, \var{string} is returned \var{repl}. If the pattern isn't found, \var{string} is returned
...@@ -404,20 +403,17 @@ The pattern may be a string or a ...@@ -404,20 +403,17 @@ The pattern may be a string or a
regex object; if you need to specify regex object; if you need to specify
regular expression flags, you must use a regex object, or use regular expression flags, you must use a regex object, or use
embedded modifiers in a pattern; e.g. embedded modifiers in a pattern; e.g.
\samp{sub("(?i)b+", "x", "bbbb BBBB")} returns \code{'x x'}.
\begin{verbatim}
sub("(?i)b+", "x", "bbbb BBBB") returns 'x x'.
\end{verbatim}
The optional argument \var{count} is the maximum number of pattern The optional argument \var{count} is the maximum number of pattern
occurrences to be replaced; count must be a non-negative integer, and occurrences to be replaced; count must be a non-negative integer, and
the default value of 0 means to replace all occurrences. the default value of 0 means to replace all occurrences.
Empty matches for the pattern are replaced only when not adjacent to a Empty matches for the pattern are replaced only when not adjacent to a
previous match, so \code{sub('x*', '-', 'abc')} returns '-a-b-c-'. previous match, so \samp{sub('x*', '-', 'abc')} returns \code{'-a-b-c-'}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{subn}{pattern\, repl\, string\optional{, count=0}} \begin{funcdesc}{subn}{pattern, repl, string\optional{, count\code{ = 0}}}
Perform the same operation as \function{sub()}, but return a tuple Perform the same operation as \function{sub()}, but return a tuple
\code{(\var{new_string}, \var{number_of_subs_made})}. \code{(\var{new_string}, \var{number_of_subs_made})}.
\end{funcdesc} \end{funcdesc}
...@@ -425,8 +421,8 @@ Perform the same operation as \function{sub()}, but return a tuple ...@@ -425,8 +421,8 @@ Perform the same operation as \function{sub()}, but return a tuple
\begin{excdesc}{error} \begin{excdesc}{error}
Exception raised when a string passed to one of the functions here Exception raised when a string passed to one of the functions here
is not a valid regular expression (e.g., unmatched parentheses) or is not a valid regular expression (e.g., unmatched parentheses) or
when some other error occurs during compilation or matching. (It is when some other error occurs during compilation or matching. It is
never an error if a string contains no match for a pattern.) never an error if a string contains no match for a pattern.
\end{excdesc} \end{excdesc}
\subsection{Regular Expression Objects} \subsection{Regular Expression Objects}
...@@ -434,7 +430,7 @@ Compiled regular expression objects support the following methods and ...@@ -434,7 +430,7 @@ Compiled regular expression objects support the following methods and
attributes: attributes:
\setindexsubitem{(re method)} \setindexsubitem{(re method)}
\begin{funcdesc}{match}{string\optional{\, pos}\optional{\, endpos}} \begin{funcdesc}{match}{string\optional{, pos}\optional{, endpos}}
If zero or more characters at the beginning of \var{string} match If zero or more characters at the beginning of \var{string} match
this regular expression, return a corresponding this regular expression, return a corresponding
\class{MatchObject} instance. Return \code{None} if the string does not \class{MatchObject} instance. Return \code{None} if the string does not
...@@ -452,7 +448,7 @@ attributes: ...@@ -452,7 +448,7 @@ attributes:
searched for a match. searched for a match.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{search}{string\optional{\, pos}\optional{\, endpos}} \begin{funcdesc}{search}{string\optional{, pos}\optional{, endpos}}
Scan through \var{string} looking for a location where this regular Scan through \var{string} looking for a location where this regular
expression produces a match. Return \code{None} if no expression produces a match. Return \code{None} if no
position in the string matches the pattern; note that this is position in the string matches the pattern; note that this is
...@@ -462,28 +458,28 @@ attributes: ...@@ -462,28 +458,28 @@ attributes:
meaning as for the \method{match()} method. meaning as for the \method{match()} method.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{split}{string\, \optional{, maxsplit=0}} \begin{funcdesc}{split}{string, \optional{, maxsplit\code{ = 0}}}
Identical to the \function{split()} function, using the compiled pattern. Identical to the \function{split()} function, using the compiled pattern.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{sub}{repl\, string\optional{, count=0}} \begin{funcdesc}{sub}{repl, string\optional{, count\code{ = 0}}}
Identical to the \function{sub()} function, using the compiled pattern. Identical to the \function{sub()} function, using the compiled pattern.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{subn}{repl\, string\optional{, count=0}} \begin{funcdesc}{subn}{repl, string\optional{, count\code{ = 0}}}
Identical to the \function{subn()} function, using the compiled pattern. Identical to the \function{subn()} function, using the compiled pattern.
\end{funcdesc} \end{funcdesc}
\setindexsubitem{(regex attribute)} \setindexsubitem{(regex attribute)}
\begin{datadesc}{flags} \begin{datadesc}{flags}
The flags argument used when the regex object was compiled, or 0 if no The flags argument used when the regex object was compiled, or
flags were provided. \code{0} if no flags were provided.
\end{datadesc} \end{datadesc}
\begin{datadesc}{groupindex} \begin{datadesc}{groupindex}
A dictionary mapping any symbolic group names (defined by A dictionary mapping any symbolic group names defined by
\code{?P<\var{id}>}) to group numbers. The dictionary is empty if no \code{(?P<\var{id}>)} to group numbers. The dictionary is empty if no
symbolic groups were used in the pattern. symbolic groups were used in the pattern.
\end{datadesc} \end{datadesc}
...@@ -531,9 +527,7 @@ singleton tuple is returned in such cases.) ...@@ -531,9 +527,7 @@ singleton tuple is returned in such cases.)
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{start}{\optional{group}} \begin{funcdesc}{start}{\optional{group}}
\end{funcdesc} \funcline{end}{\optional{group}}
\begin{funcdesc}{end}{\optional{group}}
Return the indices of the start and end of the substring Return the indices of the start and end of the substring
matched by \var{group}; \var{group} defaults to zero (meaning the whole matched by \var{group}; \var{group} defaults to zero (meaning the whole
matched substring). matched substring).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment