Learn R Programming

userfriendlyscience (version 0.7.2)

escapeRegex: Escapes any characters that would have special meaning in a reqular expression.

Description

Escapes any characters that would have special meaning in a reqular expression.

Usage

escapeRegex(string)

Arguments

string

string being operated on.

Value

The value of the string with any characters that would have special meaning in a reqular expression escaped.

Details

escapeRegex will escape any characters that would have special meaning in a reqular expression. For any string grep(regexpEscape(string), string) will always be true.

See Also

grep, Hmisc, http://biostat.mc.vanderbilt.edu/wiki/Main/Hmisc, https://github.com/harrelfe/Hmisc

Examples

Run this code
# NOT RUN {
string <- "this\\(system) {is} [full]."
escapeRegex(string)
# }

Run the code above in your browser using DataLab