str1 <- "I don't know 'how' to remove these ' things"
gsub("\\b'\\b(*SKIP)(*F)|'", "", str1, perl=TRUE)