escapeRegex

0th

Percentile

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

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

Keywords
character , programming , manip
Usage
escapeRegex(string)
escapeBS(string)
Arguments
string

string being operated on.

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.

escapeBS will escape any backslash \ in a string.

Value

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

See Also

grep

Aliases
  • escapeRegex
  • escapeBS
Examples
# NOT RUN {
string <- "this\\(system) {is} [full]."
escapeRegex(string)

escapeBS(string)

# }
Documentation reproduced from package Hmisc, version 4.4-0, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.