x <- c("123AB123 CDe FG123-4", "ABCD A123B")regmatches(x, gregexpr("(?<!\\S)(?=\\S*\\p{L})(?=\\S*\\d)\\S+", x, perl=TRUE))
Standard input is empty
[[1]] [1] "123AB123" "FG123-4" [[2]] [1] "A123B"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!