I just want find rows with the repeated word HALL (more than one time). For example, "HALL #1 HALL #2 HALL #3". I tried to use
grepl("HALL{2,}", "HALL #1 HALL #2 HALL #3")
but grepl returned FALSE. What am I doing wrong?
You can use stringr,
str_count("HALL #1 HALL #2 HALL #3", 'HALL')>1
#[1] TRUE
You could use (?:.*?HALL.*?){2,}:
grepl("(?:.*?HALL.*?){2,}", "HALL #1 HALL #2 HALL #3")
#[1] TRUE
Here is a breakdown of the above regex.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With