#
s <- c("A1 B1 C1","A2 B2", "AA A1", "AA", "B1 A1", "BB AB A1")
strextr(s, "^[AB][[:digit:]]$")
strextr(s, "^[AB][[:digit:]]$", mult = TRUE)
strextr(s, "^[AB][[:digit:]]$", mult = TRUE, unlist = TRUE)
strextr(s, "^[C][[:digit:]]$")
#
Run the code above in your browser using DataLab