text="Hi!stack overflow... is a popular website, I visit it every day."gsub("[[:space:]]*([[:punct:]]+)[[:space:]]*", " \\1 ", text)
Standard input is empty
[1] "Hi ! stack overflow ... is a popular website , I visit it every day . "
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!