I was just starting to use R again, and I was wondering if there was a way to replace part of the string with wildcards.
For instance:
say that I have
S1 <- "aaaaaaaaa[aaaaa]aaaa[bbbbbbb]aaaa"
and I want to replace everything in square brackets with "x", so a new line
"aaaaaaaaa[x]aaaa[x]aaaa"
Can this be done in R?
Please note that in square brackets it can be of variable length.
source share