| mgsub {mgsub} | R Documentation |
mgsub - A safe, simultaneous, multiple global string replacement wrapper that
allows access to multiple methods of specifying matches and replacements.
mgsub_dict - Dictionary version of mgsub that
takes a vector of replacement strings, named with their matching search terms
and applies them to a single string to be modified.
mgsub(string, pattern, replacement, recycle = FALSE, conversions = list(), ...) mgsub_dict(string, conversions = list(), ...)
string |
a character vector where replacements are sought |
pattern |
Character string to be matched in the given character vector |
replacement |
Character string equal in length to pattern or of length one which are a replacement for matched pattern. |
recycle |
logical. should replacement be recycled if lengths differ? |
conversions |
DEPRECATED - will be removed in a later release |
... |
Converted string.
mgsub("hey, ho",list("hey"="ho","ho"="hey"))
mgsub("developer",list("e" ="p", "p" = "e"))
mgsub("The chemical Dopaziamine is fake",
list("dopa(.*?) "="mega\\1 ","fake"="real"),
ignore.case=TRUE)