fork download
  1. library(stringr)
  2. Times <- c("12h00","16h30","Afternoon","15h00","14h20","7h30","06h00")
  3. str_extract(Times, '[1-9]\\d*(?=h)')
Success #stdin #stdout 0.23s 42512KB
stdin
Standard input is empty
stdout
[1] "12" "16" NA   "15" "14" "7"  "6"