diff options
author | Raymond Hettinger <python@rcn.com> | 2003-09-10 03:54:50 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-09-10 03:54:50 (GMT) |
commit | bed92ee2b21dab6c75b75effcea901d32be689b8 (patch) | |
tree | dc41f4c4b10ccf0b8745263b6b8007d6af183410 /Doc/lib/libre.tex | |
parent | 62685d36aaa3a26fb5c6a5935e387b008880436f (diff) | |
download | cpython-bed92ee2b21dab6c75b75effcea901d32be689b8.zip cpython-bed92ee2b21dab6c75b75effcea901d32be689b8.tar.gz cpython-bed92ee2b21dab6c75b75effcea901d32be689b8.tar.bz2 |
SF patch #800899: Making "|" directive from REs a bit clearer.
Diffstat (limited to 'Doc/lib/libre.tex')
-rw-r--r-- | Doc/lib/libre.tex | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Doc/lib/libre.tex b/Doc/lib/libre.tex index bf4df63..1aaebd9 100644 --- a/Doc/lib/libre.tex +++ b/Doc/lib/libre.tex @@ -186,14 +186,13 @@ except \character{\textasciicircum}. \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{[|]}. +way. This can be used inside groups (see below) as well. As the target +string is scanned, REs separated by \character{|} are tried from left to +right. When one pattern completely matches, that branch is accepted. +This means that once \code{A} matches, \code{B} will not be tested further, +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 parentheses, and indicates the start and end of a group; the contents |