re2_detect | R Documentation |
Equivalent to grepl(pattern, x). Vectorized over
string and pattern. For the equivalent of
grep(pattern, x) see re2_which
.
re2_detect(string, pattern)
string |
A character vector, or an object which can be coerced to one. |
pattern |
Character string containing a regular expression,
or a pre-compiled regular expression (or a vector of character
strings and pre-compiled regular expressions). |
A logical vector. TRUE if match is found, FALSE if not.
re2_regexp
for options to regular expression,
re2_syntax for regular expression syntax, and
re2_match
to extract matched groups.
## Character vector input
s <- c("barbazbla", "foobar", "not present here ")
pat <- "(foo)|(bar)baz"
re2_detect(s, pat)
## Use precompiled regexp
re <- re2_regexp("(foo)|(bAR)baz", case_sensitive = FALSE)
re2_detect(s, re)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.