fork(1) download
  1. string <- "This is a baaaad unnnnecessary short word"
  2. gsub("\\s*[[:alpha:]]*([[:alpha:]])\\1{2}[[:alpha:]]*", "", string)
  3. gsub("\\s*\\p{L}*(\\p{L})\\1{2}\\p{L}*", "", string, perl=TRUE)
  4. library(stringr)
  5. str_replace_all(string, "\\s*\\p{L}*(\\p{L})\\1{2}\\p{L}*", "")
Success #stdin #stdout 0.27s 42976KB
stdin
Standard input is empty
stdout
[1] "This is a short word"
[1] "This is a short word"
[1] "This is a short word"