I am working R. I want to extract all numbers between the last blank space and a string pattern ("-APPLE") in a vector. The numbers can be of variable length.
test_string = c("ABC 2-APPLE", "123 25-APPLE", "DEF GHI 567-APPLE", "ORANGE")
Expected Result set should be a vector as in c(2, 25, 567, NA)