Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1f8cee2

Browse files
committed
Hint about [\] trick to avoid quad backslashes.
1 parent db5a41f commit 1f8cee2

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

Doc/lib/libregex.tex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ \section{Built-in Module \sectcode{regex}}
2222
they are followed by an unrecognized escape character.
2323
\emph{However}, if you want to include a literal \dfn{backslash} in a
2424
regular expression represented as a string literal, you have to
25-
\emph{quadruple} it. E.g.\ to extract \LaTeX\ \samp{\e section\{{\rm
25+
\emph{quadruple} it or enclose it in a singleton character class.
26+
E.g.\ to extract \LaTeX\ \samp{\e section\{{\rm
2627
\ldots}\}} headers from a document, you can use this pattern:
27-
\code{'\e \e \e \e section\{\e (.*\e )\}'}. \emph{Another exception:}
28+
\code{'[\e ] section\{\e (.*\e )\}'}. \emph{Another exception:}
2829
the escape sequece \samp{\e b} is significant in string literals
2930
(where it means the ASCII bell character) as well as in Emacs regular
3031
expressions (where it stands for a word boundary), so in order to

Doc/libregex.tex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ \section{Built-in Module \sectcode{regex}}
2222
they are followed by an unrecognized escape character.
2323
\emph{However}, if you want to include a literal \dfn{backslash} in a
2424
regular expression represented as a string literal, you have to
25-
\emph{quadruple} it. E.g.\ to extract \LaTeX\ \samp{\e section\{{\rm
25+
\emph{quadruple} it or enclose it in a singleton character class.
26+
E.g.\ to extract \LaTeX\ \samp{\e section\{{\rm
2627
\ldots}\}} headers from a document, you can use this pattern:
27-
\code{'\e \e \e \e section\{\e (.*\e )\}'}. \emph{Another exception:}
28+
\code{'[\e ] section\{\e (.*\e )\}'}. \emph{Another exception:}
2829
the escape sequece \samp{\e b} is significant in string literals
2930
(where it means the ASCII bell character) as well as in Emacs regular
3031
expressions (where it stands for a word boundary), so in order to

0 commit comments

Comments
 (0)