'grepl to search strings containing more than 2 paterns than includes parenthesis in R
Good afternoon, I want to search for a string that contains two times the pattern "1)2"
I tried: grepl('(1.+\).+2){2}', variable, fixed=TRUE)
Thank you very much in advance¡¡¡¡
Solution 1:[1]
How about this:
> grepl(".*1\\)2.*1\\)2.*", c("bla1)2bla", "bla1)2blabla1)2bla", "blablabla"))
[1] FALSE TRUE FALSE
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Santiago Capobianco |
