diff options
author | Guido van Rossum <guido@python.org> | 1997-03-14 04:10:13 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-03-14 04:10:13 (GMT) |
commit | 1f8cee2521e8a659bf7dc02ace280dd025500409 (patch) | |
tree | 725f4aaff3c6207e27524d2c17483008361cff73 /Doc | |
parent | db5a41f16bf41db30e20e584e2fc163ac4f205ed (diff) | |
download | cpython-1f8cee2521e8a659bf7dc02ace280dd025500409.zip cpython-1f8cee2521e8a659bf7dc02ace280dd025500409.tar.gz cpython-1f8cee2521e8a659bf7dc02ace280dd025500409.tar.bz2 |
Hint about [\] trick to avoid quad backslashes.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libregex.tex | 5 | ||||
-rw-r--r-- | Doc/libregex.tex | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/Doc/lib/libregex.tex b/Doc/lib/libregex.tex index 9766c2c..d3f44ba 100644 --- a/Doc/lib/libregex.tex +++ b/Doc/lib/libregex.tex @@ -22,9 +22,10 @@ is because Python doesn't remove backslashes from string literals if they are followed by an unrecognized escape character. \emph{However}, if you want to include a literal \dfn{backslash} in a regular expression represented as a string literal, you have to -\emph{quadruple} it. E.g.\ to extract \LaTeX\ \samp{\e section\{{\rm +\emph{quadruple} it or enclose it in a singleton character class. +E.g.\ to extract \LaTeX\ \samp{\e section\{{\rm \ldots}\}} headers from a document, you can use this pattern: -\code{'\e \e \e \e section\{\e (.*\e )\}'}. \emph{Another exception:} +\code{'[\e ] section\{\e (.*\e )\}'}. \emph{Another exception:} the escape sequece \samp{\e b} is significant in string literals (where it means the ASCII bell character) as well as in Emacs regular expressions (where it stands for a word boundary), so in order to diff --git a/Doc/libregex.tex b/Doc/libregex.tex index 9766c2c..d3f44ba 100644 --- a/Doc/libregex.tex +++ b/Doc/libregex.tex @@ -22,9 +22,10 @@ is because Python doesn't remove backslashes from string literals if they are followed by an unrecognized escape character. \emph{However}, if you want to include a literal \dfn{backslash} in a regular expression represented as a string literal, you have to -\emph{quadruple} it. E.g.\ to extract \LaTeX\ \samp{\e section\{{\rm +\emph{quadruple} it or enclose it in a singleton character class. +E.g.\ to extract \LaTeX\ \samp{\e section\{{\rm \ldots}\}} headers from a document, you can use this pattern: -\code{'\e \e \e \e section\{\e (.*\e )\}'}. \emph{Another exception:} +\code{'[\e ] section\{\e (.*\e )\}'}. \emph{Another exception:} the escape sequece \samp{\e b} is significant in string literals (where it means the ASCII bell character) as well as in Emacs regular expressions (where it stands for a word boundary), so in order to |