# NOT RUN {
exampleSource <-
"Do you like icecream?
Well, that depends\u2026 Sometimes, when it's..... Nice. Then I do,
but otherwise... not really, actually."
### Default settings:
cat(clean_source(exampleSource));
### First remove existing newlines:
cat(clean_source(exampleSource,
removeNewlines=TRUE));
exampleSource <-
"Do you like icecream?
Well, that depends\u2026 Sometimes, when it's..... Nice. Then I do,
but otherwise... not really, actually."
### Simple text replacements:
cat(search_and_replace_in_source(exampleSource,
replacements=list(c("\u2026", "..."),
c("Nice", "Great"))));
### Using a regular expression to capitalize all words following
### a period:
cat(search_and_replace_in_source(exampleSource,
replacements=list(c("\\.(\\s*)([a-z])", ".\\1\\U\\2"))));
# }
Run the code above in your browser using DataLab