fork download
  1. tx <- "I want: spaces around all these marks;:!?.but i didn’t want it there in didn't"
  2. gsub("\\s*(\\.+|[[:punct:]])(?<!\\b['’]\\b)\\s*", " \\1 ", tx, perl=TRUE)
Success #stdin #stdout 0.25s 39260KB
stdin
Standard input is empty
stdout
[1] "I want : spaces around all these marks ;  :  !  ?  . but i didn’t want it there in didn't"