I would like to replace a part of a string, however, I want the match to be exact. In the case bellow I want ABC to be replaced with mytag and not A to be replaced with mytag etc.
mytags <- c("A","AB","ABC","B","BB","BBC","C","CB","CBC")
x <- "I would like to replace ABC with mytag"
stri_replace_all_fixed(x,mytags,"mytag", vectorize_all=TRUE)
[1] "I would like to replace mytagBC with mytag" "I would like to replace mytagC with mytag" "I
would like to replace mytag with mytag"
[4] "I would like to replace AmytagC with mytag" "I would like to replace ABC with mytag" "I
would like to replace ABC with mytag"
[7] "I would like to replace ABmytag with mytag" "I would like to replace ABC with mytag" "I
would like to replace ABC with mytag"
What I would like to get is:
[1] "I would like to replace mytag with mytag"