Created
January 17, 2017 22:25
-
-
Save arbelt/f3bcc00edba8a508ba813b4caa91558a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(stringr) | |
library(purrr) | |
match_multiple <- function(strings, patterns){ | |
match_fns <- map( | |
as.list(patterns), | |
~ partial(str_detect, pattern = ., .lazy = FALSE, .first = FALSE)) | |
reduce(invoke_map(match_fns, list(list(strings))), `|`) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment