summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2000-10-05 15:22:28 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2000-10-05 15:22:28 (GMT)
commit9351dd2084262b67d58f2dc7c084bf48353f587d (patch)
tree8a9bcf838677ed561d6ce73133611f00dffc617e /Doc
parentdc9100f57d5f20a4b9de644b7046de3c59197639 (diff)
downloadcpython-9351dd2084262b67d58f2dc7c084bf48353f587d.zip
cpython-9351dd2084262b67d58f2dc7c084bf48353f587d.tar.gz
cpython-9351dd2084262b67d58f2dc7c084bf48353f587d.tar.bz2
Document the lookbehind assertions (closing bug#115119)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libre.tex15
1 files changed, 15 insertions, 0 deletions
diff --git a/Doc/lib/libre.tex b/Doc/lib/libre.tex
index c6eca4d..0c9df2a 100644
--- a/Doc/lib/libre.tex
+++ b/Doc/lib/libre.tex
@@ -219,6 +219,21 @@ is a negative lookahead assertion. For example,
\regexp{Isaac (?!Asimov)} will match \code{'Isaac~'} only if it's \emph{not}
followed by \code{'Asimov'}.
+\item[\code{(?<=...)}] Matches if the current position in the string
+is preceded by a match for \regexp{...} that ends at the current
+position. This is called a positive lookbehind assertion.
+\regexp{(?<=abc)def} will match \samp{abcdef}, since the lookbehind
+will back up 3 characters and check if the contained pattern matches.
+The contained pattern must only match strings of some fixed length,
+meaning that \regexp{abc} or \regexp{a|b} are allowed, but \regexp{a*}
+isn't.
+
+\item[\code{(?<!...)}] Matches if the current position in the string
+is not preceded by a match for \regexp{...}. This
+is called a negative lookbehind assertion. Similar to positive lookbehind
+assertions, the contained pattern must only match strings of some
+fixed length.
+
\end{list}
The special sequences consist of \character{\e} and a character from the