I cannot find a way to do this ...
raw_string <- "\"+001\", la bonne surprise de M. Jenn M. Ayache http://goo.gl/3EXxy6 via @MYTF1News" clean_string <- "+001, la bonne surprise de Jenn Ayache" desired_string <- "\"\"MM http://goo.gl/3EXxy6 via @MYTF1News"
I am not sure what to call this transformation. I would say “difference” (as in set theory, against “union” and “intersection”). A better name might be a "relative complement" ( http://en.wikipedia.org/wiki/Complement_(set_theory)#Relative_complement ).
My search string has only and all the characters that are not in clean_string, in good order, once for every time they appear, including spaces, punctuation, and all.
The best I managed to do is not good enough:
> a <- paste(Reduce(setdiff, strsplit(c(raw_string, clean_string), split = " ")), collapse = " ") > a [1] "\"+001\", M. http://goo.gl/3EXxy6 via @MYTF1News"
source share