x <- c("feel", "agre", "degree")rx <- "^(?:[^e]*e){2}[^e]*$"grep(rx, x, value = TRUE)
Standard input is empty
[1] "feel"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!