summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3kernel/l3regex.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3regex.dtx')
-rw-r--r--macros/latex/contrib/l3kernel/l3regex.dtx48
1 files changed, 29 insertions, 19 deletions
diff --git a/macros/latex/contrib/l3kernel/l3regex.dtx b/macros/latex/contrib/l3kernel/l3regex.dtx
index db1ddee245..ac70e76eea 100644
--- a/macros/latex/contrib/l3kernel/l3regex.dtx
+++ b/macros/latex/contrib/l3kernel/l3regex.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2021-10-18}
+% \date{Released 2021-11-12}
%
% \maketitle
%
@@ -83,11 +83,12 @@
%
% If a regular expression is to be used several times,
% it can be compiled once, and stored in a regex
-% variable using \cs{regex_const:Nn}. For example,
+% variable using \cs{regex_set:Nn}. For example,
% \begin{verbatim}
-% \regex_const:Nn \c_foo_regex { \c{begin} \cB. (\c[^BE].*) \cE. }
+% \regex_new:N \l_foo_regex
+% \regex_set:Nn \l_foo_regex { \c{begin} \cB. (\c[^BE].*) \cE. }
% \end{verbatim}
-% stores in \cs[no-index]{c_foo_regex} a regular expression which matches the
+% stores in \cs[no-index]{l_foo_regex} a regular expression which matches the
% starting marker for an environment: \cs[no-index]{begin}, followed by a
% begin-group token (|\cB.|), then any number of tokens which are
% neither begin-group nor end-group character tokens (|\c[^BE].*|),
@@ -164,7 +165,7 @@
% |\A|, |\B|, \ldots{} have special meanings;
% \item non-alphanumeric printable ascii characters can (and should)
% always be escaped: many of them have special meanings (\emph{e.g.},
-% use |\(|, |\)|, |\?|, |\.|);
+% use |\(|, |\)|, |\?|, |\.|, |\^|);
% \item spaces should always be escaped (even in character
% classes);
% \item any other character may be escaped or not, without any
@@ -335,11 +336,14 @@
% \meta{regex}, anchored at the beginning and end, so that |\c{begin}|
% matches exactly \cs[no-index]{begin}, and nothing else.
% \item[\\cX] Applies to the next object, which can be a character,
-% character property, class, or group, and forces this object to
-% only match tokens with category |X| (any of |CBEMTPUDSLOA|. For
-% instance, |\cL[A-Z\d]| matches uppercase letters and digits of
-% category code letter, |\cC.| matches any control sequence, and
-% |\cO(abc)| matches |abc| where each character has category other.
+% escape character sequence such as |\x{0A}|, character class, or
+% group, and forces this object to only match tokens with category
+% |X| (any of |CBEMTPUDSLOA|. For instance, |\cL[A-Z\d]| matches
+% uppercase letters and digits of category code letter, |\cC.|
+% matches any control sequence, and |\cO(abc)| matches |abc| where
+% each character has category other.\footnote{This last example also
+% captures \enquote{\texttt{abc}} as a regex group; to avoid this
+% use a non-capturing group \texttt{\textbackslash cO(?:abc)}.}
% \item[{\\c[XYZ]}] Applies to the next object, and forces it to only
% match tokens with category |X|, |Y|, or |Z| (each being any of
% |CBEMTPUDSLOA|). For instance, |\c[LSO](..)| matches two tokens of
@@ -531,21 +535,27 @@
% \meta{regex~var} is initially such that it never matches.
% \end{function}
%
-% \begin{function}[added = 2017-05-26]
-% {\regex_set:Nn, \regex_gset:Nn, \regex_const:Nn}
+% \begin{function}[added = 2017-05-26]{\regex_set:Nn, \regex_gset:Nn}
% \begin{syntax}
% \cs{regex_set:Nn} \meta{regex~var} \Arg{regex}
% \end{syntax}
-% Stores a compiled version of the \meta{regular expression}
-% in the \meta{regex~var}. For instance, this function can be used
-% as
+% Stores a compiled version of the \meta{regular expression} in the
+% \meta{regex~var}. The assignment is local for \cs{regex_set:Nn} and
+% global for \cs{regex_gset:Nn}. For instance, this function can be
+% used as
% \begin{verbatim}
% \regex_new:N \l_my_regex
% \regex_set:Nn \l_my_regex { my\ (simple\ )? reg(ex|ular\ expression) }
% \end{verbatim}
-% The assignment is local for \cs{regex_set:Nn} and global for
-% \cs{regex_gset:Nn}. Use \cs{regex_const:Nn} for compiled expressions
-% which never change.
+% \end{function}
+%
+% \begin{function}[added = 2017-05-26]{\regex_const:Nn}
+% \begin{syntax}
+% \cs{regex_const:Nn} \meta{regex~var} \Arg{regex}
+% \end{syntax}
+% Creates a new constant \meta{regex~var} or raises an error if the name
+% is already taken. The value of the \meta{regex~var} is set
+% globally to the compiled version of the \meta{regular expression}.
% \end{function}
%
% \begin{function}[added = 2021-04-26, updated = 2021-04-29]
@@ -722,7 +732,7 @@
% locally to \meta{tl~var}.
% \end{function}
%
-% \section{Constants and variables}
+% \section{Scratch regular expressions}
%
% \begin{variable}[added = 2017-12-11]{\l_tmpa_regex, \l_tmpb_regex}
% Scratch regex for local assignment. These are never used by