Learn R Programming

RVerbalExpressions (version 0.0.0.9000)

sanitize: Escape characters expected special by regex engines

Description

Takes a string and escapes all characters considered special by the regex engine. This is used internally when you add a string to the value parameter in most of the available functions. It is exported and useable externally for users that want to escape all special characters in their desired match. The following special characters are escaped . | * ? + ( ) { } ^ $ \ : = [ ]

Usage

sanitize(x)

Arguments

x

String to sanitize

Examples

Run this code
# NOT RUN {
sanitize("^")
sanitize("^+")
sanitize("^+?")
#export - nade not exported

# }

Run the code above in your browser using DataLab