R extrae regex de la cadena

library(stringr)

x <- "aaaaa345aaa"
str_extract(x, "[1-9]+")
# [1] "345"
Matthew David