I'd like replace some words/characters using l3regex on a arbitrary variable.
Instead of doing this
\tl_set:Nn \l_myname_tl {Hello}
\regex_replace_all:nnN {(\w+)} {\1 World!} \l_myname_tl
which works, I'd like to do something like that
\def\myname{tmpname}
\cs_new_protected:cpn { l_\myname _tl } {Hello}
\regex_replace_all:nnN {(\w+)} {\1 World!} \use:c {l_\myname _tl}
I've an error saying I've an extra parenthesis }. I'm not very familiar with LaTeX3 but If I understand well, the problem comes from the \use:c {l_myname _tl}
not considered as an single token (no braced) as expected by :nnN
.
What is the way of doing that ?
Thanks in advance.