Description Usage Arguments Value References Examples
Forces replacement values to be upper or lower case. Only supported by Perl regular expressions.
1 2 3 |
x |
A character vector. |
A character vector representing part or all of a regular expression.
http://www.regular-expressions.info/replacecase.html
1 2 3 4 5 6 7 8 9 10 11 | # Convert to title case using Perl regex
x <- "In caSE of DISASTER, PuLl tHe CoRd"
matching_rx <- capture(WRD) %R% capture(wrd(1, Inf))
replacement_rx <- as_upper(REF1) %R% as_lower(REF2)
gsub(matching_rx, replacement_rx, x, perl = TRUE)
# PCRE and ICU do not currently support this operation
# The next lines are intended to return gibberish
gsub(matching_rx, replacement_rx, x)
replacement_rx_icu <- as_upper(ICU_REF1) %R% as_lower(ICU_REF2)
stringi::stri_replace_all_regex(x, matching_rx, replacement_rx_icu)
|
[1] "In Case Of Disaster, Pull The Cord"
[1] "UIELnE UcELaSEE UoELfE UDELISASTERE, UPELuLlE UtELHeE UCELoRdE"
[1] "1ELnE 1ELaSEE 1ELfE 1ELISASTERE, 1ELuLlE 1ELHeE 1ELoRdE"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.