vec_to_regex: Convert a vector to a regular expression

View source: R/vec_to_regex.R

vec_to_regexR Documentation

Convert a vector to a regular expression

Description

Often helpful when constructing a regular expression based on a vector of values

Usage

vec_to_regex(..., sep = "|", wrap = c("(", ")"))

Arguments

...

Vectors to collapse into the regex. Duplicated elements are removed.

sep

Character used to separate elements of ...

wrap

2-element vector of strings to wrap elements of ... in.

Examples

vec_to_regex(month.abb)

vec_to_regex(letters[1:5], sep = "", wrap = c("[", "]+"))

overdodactyl/mRclwhip documentation built on June 30, 2023, 6:24 a.m.