Description Usage Arguments Value Examples
Test a pattern in strings, and return boolean. Vectorised over strings and patterns.
1 2 | re2_detect(string, pattern, anchor = UNANCHORED, parallel = FALSE,
grain_size = 1e+05, ...)
|
string |
a character vector |
pattern |
a character vector or pre-compiled regular expressions |
anchor |
see |
parallel |
use multithread |
grain_size |
a minimum chunk size for tuning the behavior of parallel algorithms |
... |
further arguments passed to |
A logical vector.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | re2_detect("one", "(o.e)")
re2_detect("123-234-2222", "\\d\\d\\d-\\d\\d\\d-\\d\\d\\d\\d")
words = c("sunny","beach","happy","really")
re2_detect(words, "y")
re2_detect(words, "^b")
re2_detect(words, "[abc]")
# vectorize
(res = re2_detect("This", letters))
letters[res]
letters[re2_detect("This", letters, case_sensitive = FALSE)]
letters[re2_detect("This", re2(letters, case_sensitive = FALSE))]
# In stringi, "" empty search patterns return NA.
# In re2r, empty search patterns will match
# empty string.
re2_detect("abc", "")
stringi::stri_detect("abc", regex = "")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.