Sender: |
|
Date: |
Wed, 13 Aug 2014 21:42:39 +1200 |
MIME-version: |
1.0 |
Reply-To: |
|
Content-type: |
text/plain; charset=ISO-8859-1; format=flowed |
Subject: |
|
From: |
|
Message-ID: |
|
Content-transfer-encoding: |
7bit |
Parts/Attachments: |
|
|
I have been using l3regex and tripped on the following circumstance. Suppose
\tl_set:Nn \l_tmpa_tl { abcdef }
Then
\regex_replace_all:nnN { cd } { 12 } \l_tmpa_tl
results in \l_tmpa_tl containing ab12ef, but there is no built-in
function for the analogous match or extract function. This was
disconcerting for a moment, to discover that I could replace text but
couldn't match it. Of course I can, but it means resorting to
\exp_args:Nno as in
\exp_args:Nno \regex_match:nnTF { cd } \l_tmpa_tl { true } { false }
It would be consistent with the presence of \regex_replace_all:nnN and
\regex_replace_all:NnN if there were corresponding functions,
\regex_match:nN and \regex_match:NN, and similarly for extract.
In the context in which I was working, the token list variable
(analogous to \l_tmpa_tl above) is set to a mathematical formula
elsewhere in the code. The formula is most naturally handled in this way
as a token list variable rather than as a token list.
Andrew
|
|
|