When trying to use functions in the replace argument of the regexp function, the function is applied BEFORE the regular expression. It makes sense as it is the usual composition of functions.
For example, if I try to put minor keys in lower case in german notation, I'm tempted to do
Bu this of course transforms $1 to lowercase, that is, the same $1 string, before the regexp function evaluates it.
The question is then, how to apply functions to transform the captures of the regular expression in the replace format?