[Python-checkins] CVS: python/dist/src/Doc/lib libre.tex,1.56,1.57
Fred L. Drake
python-dev@python.org
Fri, 6 Oct 2000 12:59:27 -0700
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv19636
Modified Files:
libre.tex
Log Message:
Made a number of revisions suggested by Fredrik Lundh.
Revised the first paragraph so it doesn't sound like it was written
when 7-bit strings were assumed; note that Unicode strings can be used.
Index: libre.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -r1.56 -r1.57
*** libre.tex 2000/10/05 15:22:28 1.56
--- libre.tex 2000/10/06 19:59:22 1.57
***************
*** 1,20 ****
\section{\module{re} ---
! Perl-style regular expression operations.}
\declaremodule{standard}{re}
\moduleauthor{Andrew M. Kuchling}{amk1@bigfoot.com}
\sectionauthor{Andrew M. Kuchling}{amk1@bigfoot.com}
! \modulesynopsis{Perl-style regular expression search and match
! operations.}
This module provides regular expression matching operations similar to
! those found in Perl. It's 8-bit clean: the strings being processed
! may contain both null bytes and characters whose high bit is set. Regular
! expression pattern strings may not contain null bytes, but can specify
! the null byte using the \code{\e\var{number}} notation.
! Characters with the high bit set may be included. The \module{re}
! module is always available.
Regular expressions use the backslash character (\character{\e}) to
--- 1,20 ----
\section{\module{re} ---
! Regular expression operations}
\declaremodule{standard}{re}
\moduleauthor{Andrew M. Kuchling}{amk1@bigfoot.com}
+ \moduleauthor{Fredrik Lundh}{effbot@telia.com}
\sectionauthor{Andrew M. Kuchling}{amk1@bigfoot.com}
! \modulesynopsis{Regular expression search and match operations with a
! Perl-style expression syntax.}
This module provides regular expression matching operations similar to
! those found in Perl. Regular expression pattern strings may not
! contain null bytes, but can specify the null byte using the
! \code{\e\var{number}} notation. Both patterns and strings to be
! searched can be Unicode strings as well as 8-bit strings. The
! \module{re} module is always available.
Regular expressions use the backslash character (\character{\e}) to
***************
*** 35,38 ****
--- 35,47 ----
string notation.
+ \strong{Implementation note:}
+ The \module{re}\refstmodindex{pre} module has two distinct
+ implementations: \module{sre} is the default implementation and
+ includes Unicode support, but may run into stack limitations for some
+ patterns. Though this will be fixed for a future release of Python,
+ the older implementation (without Unicode support) is still available
+ as the \module{pre}\refstmodindex{pre} module.
+
+
\subsection{Regular Expression Syntax \label{re-syntax}}
***************
*** 156,162 ****
\item[\character{|}]\code{A|B}, where A and B can be arbitrary REs,
! creates a regular expression that will match either A or B. This can
! be used inside groups (see below) as well. To match a literal \character{|},
! use \regexp{\e|}, or enclose it inside a character class, as in \regexp{[|]}.
\item[\code{(...)}] Matches whatever regular expression is inside the
--- 165,178 ----
\item[\character{|}]\code{A|B}, where A and B can be arbitrary REs,
! creates a regular expression that will match either A or B. An
! arbitrary number of REs can be separated by the \character{|} in this
! way. This can be used inside groups (see below) as well. REs
! separated by \character{|} are tried from left to right, and the first
! one that allows the complete pattern to match is considered the
! accepted branch. This means that if \code{A} matches, \code{B} will
! never be tested, even if it would produce a longer overall match. In
! other words, the \character{|} operator is never greedy. To match a
! literal \character{|}, use \regexp{\e|}, or enclose it inside a
! character class, as in \regexp{[|]}.
\item[\code{(...)}] Matches whatever regular expression is inside the
***************
*** 184,187 ****
--- 200,208 ----
include the flags as part of the regular expression, instead of
passing a \var{flag} argument to the \function{compile()} function.
+
+ Note that the \regexp{(?x)} flag changes how the expression is parsed.
+ It should be used first in the expression string, or after one or more
+ whitespace characters. If there are non-whitespace characters before
+ the flag, the results are undefined.
\item[\code{(?:...)}] A non-grouping version of regular parentheses.