| str_with_patterns {filesstrings} | R Documentation |
Given a character vector of strings and one of patterns (in regular expression), which of the strings match all (or any) of the patterns.
str_with_patterns(strings, patterns, ignore_case = FALSE, any = FALSE)
strings |
A character vector. |
patterns |
Regular expressions. |
ignore_case |
Do we want to ignore case when matching patterns? |
any |
Set this to |
For huge character vectors, this can be quite slow and you're better off
implementing your own solution with stringr::str_detect().
A character vector of strings matching the patterns.
str_with_patterns(c("abc", "bcd", "cde"), c("b", "c"))
str_with_patterns(c("abc", "bcd", "cde"), c("b", "c"), any = TRUE)
str_with_patterns(toupper(c("abc", "bcd", "cde")), c("b", "c"), any = TRUE)
str_with_patterns(toupper(c("abc", "bcd", "cde")), c("b", "c"), any = TRUE,
ignore_case = TRUE)