vec_to_regex | R Documentation |
Collapse vectors into a regex pattern
vec_to_regex(..., sep = "|", wrap = c("(", ")"))
... |
(Vector) Vectors that will be coerced into character. Duplicated elements from the vectors are removed. |
sep |
(Char) Separator to use between elements of ... |
wrap |
(Char) 2-element vector of text to wrap the pattern with. |
A character string where every element of ...
is collapsed with sep
, and
wrapped with wrap
.
Desi Quintans (http://www.desiquintans.com)
vec_to_regex(month.abb)
#> [1] "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"
vec_to_regex(letters[1:6], sep = "", wrap = c("([", "]+)"))
#> [1] "([abcdef]+)"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.