Skip to Content

Convert punctuation to space

I have a bunch of strings with punctuation in them that I'd like to convert to spaces:

"This is a string. In addition, this is a string (with one more)."

would become:

"This is a string  In addition  this is a string  with one more  "

I can go thru and do this manually with the stringr package (str_replace_all()) one punctuation symbol at a time (, / . / ! / ( / ) / etc. ), but I'm curious if there's a faster way I'd assume using regex's.

Any suggestions?