Skip to content
Prev 350188 / 398506 Next

regexpr - ignore all special characters and punctuation in a string

Look at ?agrep:

Vec1 <- "What a nice day today! - Story of happiness: Part 2."
Vec2 <- "What a nice day today: Story of happiness (Part 2)?

# Match the words, not the punctuation.
# Not fully tested
[1] 1 2
value = TRUE)
[1] "What a nice day today! - Story of happiness: Part 2."
[2] "What a nice day today: Story of happiness (Part 2)?  


Also, possibly:

  http://cran.r-project.org/web/packages/stringdist


Regards,

Marc Schwartz