create_regex {assertive.strings} | R Documentation |
Creates a regex from regex components.
create_regex(..., l = list(), sep = "[- ]?")
... |
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". |
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').
## Not run: cas_number_components <- c( "[[:digit:]]{1,7}", "[[:digit:]]{2}", "[[:digit:]]" ) cas_number_rx <- create_regex(rx_components, sep = "-") ## End(Not run)