Here's my code :
V1 = list("1","2","3",c("1,2,3"))
before = c("1","2","3")
after = c("2AB","1CD","DC2")
stringi::stri_replace_all_regex(
V1,
before,
after,
vectorize_all = F)
)
What I'm getting is :
> stringi::stri_replace_all_regex(
+ V1,
+ before,
+ after,
+ vectorize_all = F)
[1] "1CDAB" "1CD" "DC2" "1CDAB,1CD,DC2"
which is not what I'm trying to get which should look like this :
"2AB" "1CD" "DC2" "2AB,1CD,DC2"
how do I solve this?