Description Usage Arguments See Also Examples
Substitute regular expressions in a string with another string.
1 |
data |
character vector to substitute |
pattern |
regular expression to match |
replacement |
replacement text to use |
global |
substitute all occurrences |
options |
option flags |
... |
options passed to sub or gsub |
regexp
Section "Perl-like Regular Expressions" for a
discussion of the supported options
1 2 3 4 | string <- c("this is a Test", "string")
re_substitutes(string, "test", "not a test", options = "insensitive")
re_substitutes(string, "i", "x", global = TRUE)
re_substitutes(string, "(test)", "not a \\1", options = "insensitive")
|
[1] "this is a not a test" "string"
[1] "thxs xs a Test" "strxng"
[1] "this is a not a Test" "string"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.