Let\'s say I want to find all words in which letter \"e\" appears exactly two times. When I define this pattern:
pattern1 <- \"e.*e\" grep(pattern1, stri
If you're okay not using grep
grep
stringr::str_count(words, "e") == 2
If you want more efficiency,
stringi::stri_count_fixed(words, "e") == 2
Both of these return logical vectors, you can get the words with words[..code from above..]
words[..code from above..]