I am using a regular expression replace function (in the iPadOS "Shortcuts" language). The regex is
^(\d+)$
and the replace string is
$10
Now this is supposed to append a zero on to the end of decimal numbers, by matching group one. It is not intended to mean match group ten !
This set me thinking about the more general problem. From what I read the situation seems to be a right mess with some implementations of regex engines allowing more than just the nine groups $1-$9 and others not, and some allowing alternative syntax in the replace string, like "${1}" or some such. Is there any other way around this, the situation where a digit is supposed to follow a group number ? Say something like "$1\0" for ‘literal 0’ or some kind of ‘concatenation operator’ like when "##" is used to prevent adjacent items from being seen as one single token. Or some alternative group replacement symbol?
I suppose in that one case an alternative would be to use a lookahead match in the match string instead of copying a group and putting it back in in the replace string.