I mentioned agrep
above. Here's an example with what you've explained. By varying the max.distance
we can adjust what gets kicked:
comp <- "Click xxxxx to buy the amazing xxxxx for FREE ugjh"
w <- "I love xxxx !"
x <- "Click xxxxx to purchase the awesome xxxxx for FREE bmf"
agrep(comp, c(x, w), max.distance =.4, value = TRUE)
agrep(comp, c(x, w), max.distance =.9, value = TRUE)