On 8/25/15, Joseph Wright <[log in to unmask]> wrote: > On 25/08/2015 06:16, Will Robertson wrote: >> On 26 Aug 2015, at 09:14, aparsloe <[log in to unmask]> wrote: >>> >>> (1) I wanted to use \tl_replace_all:Nnn on a token list that might >>> contain braced groups. >> >> We might want to consider a "nesting" map function that essentially >> disregards brace groups. This could be used to define a new >> \tl_replace_nested:Nnn or similar for exactly this purpose. >> >> I'm fairly sure Bruno already has code that does nested mapping as part of >> his "tl" extensions... What do others think? > > I guess I'd want to know a bit more about use cases. As I've said on > LaTeX-L, normally brace groups are an 'escape' mechanism from the > scanner, so I'm not sure I'd expect recursive replacement as a general > thing. I'm wondering if this is being used for something rather 'text > like', which might be handled by l3regex (slow but for a smaller number > of cases reasonable). I'm not completely sure that l3regex will be slower in all cases than an approach based on my nested mappings. Besides, if we find some common use-cases of regexes that can be optimized, I can work on that. For instance, I saw someone use \c{alpha}|\c{beta}|..., which is currently quite slow but can be optimized. For your information, "aparsloe", l3regex provides \u, to use the contents of a tl variable in the search or the replace part of a regular expression. Bruno