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

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)

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.

Value

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

Note

Note that this function was copied literally from the Hmisc package (to prevent importing the entire package for one line of code).

Author(s)

Charles Dupont
Department of Biostatistics
Vanderbilt University

Maintainer: Gjalt-Jorn Peters gjalt-jorn@userfriendlyscience.com

See Also

grep, Hmisc, https://hbiostat.org/R/Hmisc/, https://github.com/harrelfe/Hmisc

Examples


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



ufs documentation built on July 9, 2023, 6:07 p.m.