LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
aparsloe <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Wed, 13 Aug 2014 21:42:39 +1200
Content-Type:
text/plain
Parts/Attachments:
text/plain (27 lines)
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

ATOM RSS1 RSS2