fork(1) download
  1. x <- c("123AB123 Electrical CDe FG123-4 ...",
  2. "12/1/17 ABCD How are you today A123B",
  3. "20.9.12 Eat / Drink XY1234 for PQRS1",
  4. "Going home H123a1 ab-cd1",
  5. "Change channel for al1234 to al5678")
  6. res2 <- regmatches(x, gregexpr("(?<!\\S)(?:(?=\\S*\\p{L})(?=\\S*\\d)\\S+|(?:\\S*\\p{Lu}){2}\\S*)", x, perl=TRUE))
  7. unlist(lapply(res2, function(c) paste(unlist(c), collapse=" ")))
  8.  
Success #stdin #stdout 0.16s 178496KB
stdin
Standard input is empty
stdout
[1] "123AB123 CDe FG123-4" "ABCD A123B"           "XY1234 PQRS1"        
[4] "H123a1 ab-cd1"        "al1234 al5678"