sa<-c("100 dollars for 200 pesos", "100 dollars 200 pesos")regmatches(sa, regexpr("dollars\\D*\\K\\d+", sa, perl=TRUE))
Standard input is empty
[1] "200" "200"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!