On 25/08/2015 12:49, Bruno Le Floch wrote: >> 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. I'll take your word for it on performance! I think it's not a bad thing to say \tl_replace_all:Nnn is fast(ish) but 'simple', l3regex is slower but can 'everything' and avoid a proliferation of search-and-replace functions. Joseph