Skip to contents

[Superseded]
It's recommended to rely on the rex package instead, more precisely rex::rex(or(...)) and rex::rex(or(rex::escape(c(...)))).

Combines a vector or list of regular expressions to a single one (by logical OR).

Usage

fuse_regex(..., .literal = FALSE)

Arguments

...

Regular expressions. All elements will be converted to type character before fusing. Dynamic dots are supported.

.literal

Whether or not the input should be interpreted literally instead of as regular expressions. If TRUE, all elements of ... are wrapped in the literal escape sequences \Q and \E.

Value

A character scalar.

See also

The rex package which provides an intuitive framework to build complex regular expressions.

Other string functions: as_chr(), as_comment_str(), as_env_var_name(), as_line_feed_chr(), as_str(), capitalize_first(), dsv_colnames(), enum_str(), escape_lf(), phrase_nr(), sentenceify(), wrap_chr()

Examples

stringr::str_subset(string = c("yeah",
                               "nope",
                               "maybe",
                               "never"),
                    pattern = pal::fuse_regex(letters[1:3]))
#> [1] "yeah"  "maybe"