View source: R/0_escape_patterns.r
| escape_regex_for_types | R Documentation |
Escapes special for regex characters conditionally
fixed - Match pattern string as it is within the target vector
begins - Match pattern string as it is in the beggining of the target vector
trim_begins - Match pattern string as it is in the beginning of the target vector ignoring preceding white-spaces
ends - Match pattern string as it is in the end of the target vector
trim_ends - Match pattern string as it is in the end of the target vector ignoring leading white-spaces
exact - Match pattern string exactly (i.e., match equal strings)
trim_exact - Match pattern string exactly (i.e., match equal strings) ignoring surrounding white-spaces
regex - Match regex pattern
escape_regex_for_types(
patterns,
types,
escape_fixed = FALSE,
escape_begins = TRUE,
escape_ends = TRUE,
escape_all_if_multiple_types = TRUE
)
patterns |
character vector |
types |
character vector of the same length as |
escape_fixed |
Whether to escape strings for 'fixed' and 'exact' types in case all types are the same (length(unique(types)) == 1). The "trim_exact" types get trimed if not escaped. Otherwise if types heterogenious |
escape_begins |
Whether to escape string for 'begins' type |
escape_ends |
Whether to escape string for 'ends' type |
escape_all_if_multiple_types |
If types are multiple this applies to all esapes options |
string with all special to regex characters escaped
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.