From bcdf6c829c6761de02484473ebe43fa3760adcaa Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 12 May 2021 03:01:15 +0000 Subject: CTAN sync 202105120301 --- macros/latex/contrib/l3kernel/l3regex.dtx | 34 +++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'macros/latex/contrib/l3kernel/l3regex.dtx') diff --git a/macros/latex/contrib/l3kernel/l3regex.dtx b/macros/latex/contrib/l3kernel/l3regex.dtx index 0824cbcb97..4962ca6fa2 100644 --- a/macros/latex/contrib/l3kernel/l3regex.dtx +++ b/macros/latex/contrib/l3kernel/l3regex.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2021-05-07} +% \date{Released 2021-05-11} % % \maketitle % @@ -270,11 +270,15 @@ % \item[\{$n,m$\}] At least $n$, no more than $m$, greedy. % \item[\{$n,m$\}?] At least $n$, no more than $m$, lazy. % \end{l3regex-syntax} +% For greedy quantifiers the regex code will first investigate matches +% that involve as many repetitions as possible, while for lazy +% quantifiers it investigates matches with as few repetitions as +% possible first. % % Alternation and capturing groups. % \begin{l3regex-syntax} % \item[A\char`|B\char`|C] Either one of \texttt{A}, \texttt{B}, -% or \texttt{C}. +% or \texttt{C}, investigating \texttt{A} first. % \item[(\ldots{})] Capturing group. % \item[(?:\ldots{})] Non-capturing group. % \item[(?\char`|\ldots{})] Non-capturing group which resets @@ -5652,17 +5656,21 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_replacement_normal:n #1 { - \tl_if_empty:NTF \l_@@_replacement_category_tl - { \@@_replacement_normal_aux:N #1 } - { % ( - \token_if_eq_charcode:NNTF #1 ) - { - \seq_pop:NN \l_@@_replacement_category_seq - \l_@@_replacement_category_tl - } - { - \use:c { @@_replacement_c_ \l_@@_replacement_category_tl :w } - ? #1 + \int_compare:nNnTF { \l_@@_replacement_csnames_int } > 0 + { \exp_args:No \@@_replacement_put:n { \token_to_str:N #1 } } + { + \tl_if_empty:NTF \l_@@_replacement_category_tl + { \@@_replacement_normal_aux:N #1 } + { % ( + \token_if_eq_charcode:NNTF #1 ) + { + \seq_pop:NN \l_@@_replacement_category_seq + \l_@@_replacement_category_tl + } + { + \use:c { @@_replacement_c_ \l_@@_replacement_category_tl :w } + ? #1 + } } } } -- cgit v1.2.3