powered by
regexprep(s, expr, repstr, ignorecase = FALSE, once = FALSE)
The syntax for regular expression has to be PERL-like.
gsub
s <- "bat cat can car COAT court cut ct CAT-scan" pat <- 'c[aeiou]+t' regexprep(s, pat, '---') regexprep(s, pat, '---', once = TRUE) regexprep(s, pat, '---', ignorecase = TRUE)
Run the code above in your browser using DataLab