Description Usage Arguments Details Value Note Author(s)
Obtain a specific regex to apply in a vector or column
1 2 3 4 5 6 7 | obtain_regex(
pattern = NULL,
return_regex = c("starts_with_pattern", "not_starts_with_pattern",
"ends_with_pattern", "not_ends_with_pattern", "before_pattern", "after_pattern",
"between_pattern", "contains_pattern", "not_contains_pattern", "extract_pattern",
"not_extract_pattern", "or", "special_chrs", "regex_dates")
)
|
pattern |
based on this string we obtain the regex. |
return_regex |
choice of regex you want to obtain. |
This function allows you to obtain a regex based on your necesities with the intention that you do not focus on the regex part.
This function return different results based on return_regex
argument.
If return_regex = "or"
, then pattern
could be a vector of length greater or equal to 1.
If return_regex = "between_pattern"
, then pattern
needs to be a vector of length 2.
If return_regex = "special_chrs"
or return_regex = "regex_dates"
, then we do not need to specify pattern
, since we are going to return a vector of specific regexes.
Other case the pattern
needs to have length greater or equal to 1.
If you want to get the regex inside another regex you need to apply more than once this function, since the output is only based on pattern
Eduardo Trujillo
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.