I do not know about the speed or amount of input, but here an approach is used using the qdap beg2char and char2end :
## xx <- c("fefe.3. fregg, ff, 34.gr. trgw", ## "fefe3. fregg, ff, 34.gr. trgw", ## "fefe3 fregg, ff, 34.gr. tr.gw") library(qdap) paste0(gsub("\\.", "", beg2char(xx, ",")), char2end(xx, ",", include=TRUE)) ## > paste0(gsub("\\.", "", beg2char(xx, ",")), char2end(xx, ",", include=TRUE)) ## [1] "fefe3 fregg, ff, 34.gr. trgw" "fefe3 fregg, ff, 34.gr. trgw" ## [3] "fefe3 fregg, ff, 34.gr. tr.gw"
source share