str1 <- "I don't know 'how' to remove these ' things"gsub("\\b'\\b(*SKIP)(*F)|'", "", str1, perl=TRUE)
Standard input is empty
[1] "I don't know how to remove these things"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!