R/regexpEscape.s

Defines functions escapeRegex escapeBS

Documented in escapeBS escapeRegex

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

escapeRegex <- function(string) {
  gsub('([.|()\\^{}+$*?]|\\[|\\])', '\\\\\\1', string)
}

Try the Hmisc package in your browser

Any scripts or data that you put into this service are public.

Hmisc documentation built on June 22, 2024, 12:19 p.m.