* Bruno Le Floch <[log in to unmask]> [2012-02-02 10:57:16 -0500]: Hi Bruno, : > : Now here is the question. What I'd like to know if there's an easy way : > : for a substitution of the form : > : a[expression] -> \csname myA[expression]\endcsname : : \regex_replace_all:nnN : { a \[ (.+?) \] } { \c{ myA \[ \1 \] } } \l_your_tl Great. Thanks. That's very useful. : or, if the names "a" and "myA" are actually stored in some variables : (in particular, if they contain characters that may be unsafe in : regular expressions), say, \l_array_name_tl and \l_rec_name_tl, you : can use the \u escape sequence (specific to l3regex, not present in : Perl or PCRE): : : \regex_replace_all:nnN : { \u{l_array_name_tl} \[ (.+?) \] } : { \c{ \u{l_rec_name_tl} \[ \1 \] } } \l_your_tl Thanks. : Feel free to ask details about the syntax: I'm not happy with how it's : explained in the doc. Here is a possible approach for parsing the I have a few minor comments on the doc. I'll forward them to you later because they're at home and I'm at work (for a change; I usually work from home). : If I understand correctly, you want to use regular expressions to : parse that. I think it is possible. A starting point is as follows. : I'm using \tl_replace_all whenever possible rather than the more : powerful regex features, because the former is roughly 100 times : faster. That's useful to know. : [ code ] : I hope the first part of that email was easy enough; the second part : probably wasn't :). I assume that you are going to post the final : solution on TeX.sx? Thanks. The code is a bit difficult for me at the moment because I'm still getting used to expl3 and friends. I can see what you're doing at the start. I'm using TeX pattern matching for that:-). I will post my example to TeX.sx when I'm done. I've made some simplifications which really simplify the overall implementation. I think the end product will look nice. Regards, Marc