Escapes special for different types of pattern
Source:R/0_escape_patterns.r
escape_regex_for_type.Rd
Escapes special for different types of pattern
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
Usage
escape_regex_for_type(
string,
type,
escape_fixed = FALSE,
return_docs = FALSE,
return_choices = FALSE,
escape_begins = TRUE,
escape_ends = TRUE
)
Arguments
- string
character vector (patterns)
- type
How the characters in patterns should be 'escaped' for proper matching. The options are:
- escape_fixed
Whether to escape string for 'fixed' and 'exact' types and just trimmed string for "trim_exact". Default is FALSE
- return_docs
Return character vector of documentation for each type (for using with roxygen2 documentations in many places)
- return_choices
Return character vector of available escape types
- escape_begins
Whether to escape string for 'begins' type
- escape_ends
Whether to escape string for 'ends' type