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

View source: R/regexpEscape.s

escapeRegexR Documentation

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)
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.

Author(s)

Charles Dupont
Department of Biostatistics
Vanderbilt University

See Also

grep

Examples

string <- "this\\(system) {is} [full]."
escapeRegex(string)

escapeBS(string)



Hmisc documentation built on Sept. 12, 2023, 5:06 p.m.