Generate a Regular Expression for Finding Multiple Patterns in a Text
match_all(pattern1, pattern2 = "")
Two character strings each containing a word or a stringi-search-regex to be found in the same text. Alternately, pattern1 can be a character vector.
The maximum number of words intervening between the two specified patterns
match_all is a convenience function that creates a regular expression pattern for finding if two words (or other regular expression patterns) occur within a text
A regular expression pattern
1 2 3 4 5 6 7 8
colors <- "red|blue|yellow" sentences <- c("The car parked by their house was red", "Her yellow cat enjoys the sun on the windowsill", "The blue city bus passed right by the stopped truck") stringr::str_detect(sentences, match_all("yellow", "car")) stringr::str_detect(sentences, match_all(colors, "car")) stringr::str_detect(sentences, match_all(colors, "car|bus")) stringr::str_detect(sentences, match_all(c("bus", "truck", "city")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.