How to substitute a special character between words in R [duplicate]
This question already has an answer here: How to replace many special characters with “something plus special characters” in R 3 answers I have a string of characters. str = c(".wow", "if.", "not.confident", "wonder", "have.difficulty", "shower") I am trying to replace "." in between words with a whitespace. So it would look like this ".wow", "if.", "not confident", "wonder", "have difficulty", "shower" First, I tried gsub("[\\w.\\w]", " ", str) [1] " o " "if" "not confident" " onder" [5] "have difficulty" "sho er " It gave me the whitespace I want, but chopped off all the w's. Then, I tried