Description Usage Arguments Value Examples
View source: R/str_detect_multiple.R
Vectorised over 'string' and 'pattern'. Equivalent to str_detect, but capable of multiple patterns.
1 2 3 4 5 | str_detect_multiple(string, patterns, method)
str_detect_multiple_and(string, patterns)
str_detect_multiple_or(string, patterns)
|
string |
Input vector. Either a character vector, or something coercible to one. |
patterns |
Patterns to look for as a character vector (e.g. c("foo", "bar) ) The default interpretation of each pattern in the character vector is a regular expression, as described in stringi::stringi-search-regex. Control options with regex(). Match a fixed string (i.e. by comparing only bytes), using fixed(). This is fast, but approximate. Generally, for matching human text, you'll want coll() which respects character matching rules for the specified locale. Match character, word, line and sentence boundaries with boundary(). An empty pattern, "", is equivalent to boundary("character"). |
method |
Match method: "and" or "or". "and" will only match strings where all patterns in the character vector are found in the string. "or" will match strings where any of the patterns in the character vector are found in the string. |
The part of the string after the first pattern and before the second pattern.
1 2 3 4 5 6 7 | test_string <- 'complicated_file_name-32.csv'
str_detect_multiple(test_string, c('hadley', 'csv'), method = "and")
str_detect_multiple(test_string, c('hadley', 'csv'), method = "or")
str_detect_multiple_and(test_string, c('hadley', 'csv'))
str_detect_multiple_or(test_string, c('hadley', 'csv'))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.