fork download
  1. x <- c("T12_50;Y13_50;Y3_33", "Y15_100")
  2. library(stringr)
  3. res <- lapply(str_match_all(x, "Y\\d+_(\\d+)"), function(m) m[,-1])
  4. res
  5.  
  6. regmatches(x, gregexpr("Y\\d+_\\K\\d+", x, perl=TRUE))
Success #stdin #stdout 0.3s 44240KB
stdin
Standard input is empty
stdout
[[1]]
[1] "50" "33"

[[2]]
[1] "100"

[[1]]
[1] "50" "33"

[[2]]
[1] "100"