Skip to contents

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

Usage

str_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 base::gsub(),

Value

A character vector with all pattern matches replaced.

Examples

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