create_regex

0th

Percentile

Create a regex from components.

Creates a regex from regex components.

Usage
create_regex(..., l = list(), sep = "[- ]?")
Arguments
...
Character vectors of regex components.
l
A list of character vectors for alternate specification.
sep
Regex for separating components of complete regex. Defaults to "an optional space or hyphen".
Value

A string containing a regex. Each element in the vectors are pasted together, separated by the sep value. Those character vectors are then preceded by "^" (regex for 'start of string'() and followed by "$" (regex for end of string). Finally, the regexes are collapsed with "|" (regex for 'or').

Aliases
  • create_regex
Examples
library(assertive.strings) ## Not run: # cas_number_components <- c( # "[[:digit:]]{1,7}", "[[:digit:]]{2}", "[[:digit:]]" # ) # cas_number_rx <- create_regex(rx_components, sep = "-") # ## End(Not run)
Documentation reproduced from package assertive.strings, version 0.0-3, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.