I'm trying to extract all elements of a string except for a designated substring. I would like to extract everything except the words select and from, and everything in between. I can extract the substring, but I can't figure out how to extract everything except the substring.
a <- "10 bananas select green apples from fruit where (select pears from apples order by fruit)"
#I can successfully extract the substrings using the following code, but I'm looking for the opposite:
str_extract_all(a, "select.*?from")
#expected output
a<-"10 bananas fruit where ( apples order by fruit)"