fork download
  1. x <- c("h a g wells j g verne", "h a g wells j g")
  2. gsub("(?<=\\b\\w) (?=\\w\\b)|(?<=\\b\\w)(?= |$)", ".", x, perl=TRUE)
Success #stdin #stdout 0.24s 39372KB
stdin
Standard input is empty
stdout
[1] "h.a.g. wells j.g. verne" "h.a.g. wells j.g."