str = "we are friends"##gsub('\\b(?=\\w)', ' ', str, perl=T)gsub('(?<!\\w)\\b', ' ', str, perl=T)
Standard input is empty
[1] " we are friends"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!