R/regexpEscape.s

Defines functions escapeRegex escapeBS

Documented in escapeBS escapeRegex

escapeBS <- function(string) {
  gsub('\\\\', '\\\\\\\\\\', string)
}

escapeRegex <- function(string) {
  gsub('([.|()\\^{}+$*?]|\\[|\\])', '\\\\\\1', string)
}
harrelfe/Hmisc documentation built on Oct. 3, 2019, 9:34 p.m.