ss <- c('jobs?search=term1&location=&distance=10+page=2','jobs?search=term1+term2&location=ca&distance=30','jobs?search=term1+term2+term3&location=nyc&distance=25')results <- regmatches(ss, regexec("[&?]search=([^&+]+)(?:&|$)",ss))unlist(results)[2]
Standard input is empty
[1] "term1"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!