I am looking for a regex expression to capture strings where the pattern is repeated **n** times. Here is an example with expected output. 

```
# find sentences with 2 occurrences of the word "is"
z = c("this is what it is and is not", "this is not", "this is it it is")
regex_function(z)
[1] FALSE FALSE  TRUE  

```

I have gotten this far: 

```
grepl("(.*\\bis\\b.*){2}",z)
[1] TRUE FALSE  TRUE   

```

But this will return `TRUE` if there are *at least* 2 matches. How can I force it to look for strings with exactly 2 occurrences?