How to use gsub with more than 9 backreferences? I would expect the output in the example below to be \"e, g, i, j, o\".
> test <- \"abcdefghijklmnop\"
&g
The stri_replace_*_regex
functions from the stringi package do not have such limitations:
library("stringi")
stri_replace_all_regex("abcdefghijkl", "(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)", "$10$1$11$12")
## [1] "jakl"
If you want to follow the 1st capture group with 1, use e.g.
stri_replace_all_regex("abcdefghijkl", "(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)", "$10$1$1\\1$12")
## [1] "jaa1l"