grep_sub | R Documentation |
gsub()
on elements matched from grep()
This function is a shorthand of gsub(pattern, replacement, grep(pattern, x, value = TRUE))
.
grep_sub(pattern, replacement, x, ...)
pattern , replacement , x , ... |
Passed to |
A character vector.
# find elements that matches 'a[b]+c' and capitalize 'b' with perl regex
xfun::grep_sub("a([b]+)c", "a\\U\\1c", c("abc", "abbbc", "addc", "123"), perl = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.