Skip to contents

Iterates over a vector of patterns, applying gsub sequentially with the same replacement string for each.

Usage

mgsub(mydata, pattern, replacement, ...)

Arguments

mydata

Character vector to search within.

pattern

Character vector of patterns to search for.

replacement

Character. The replacement string applied for all patterns.

...

Additional arguments passed to gsub, such as fixed or ignore.case.

Value

A character vector with all pattern matches replaced.

Examples

mgsub(mydata="#$%^&*_+",pattern=c("%","*"),"REPLACE",fixed=TRUE)
#> [1] "#$REPLACE^&REPLACE_+"