escapeWhitespaceRegexp | R Documentation |
Escape whitespace in regular expression patterns
escapeWhitespaceRegexp(x, whitespace = "_ ", maxN = 20, ...)
x |
character vector containing a regular expression pattern, or a character value that should be converted to a regular expression pattern. |
whitespace |
character vector |
maxN |
integer value for maximum iterations of the substitution, unfortunately the regular expression logic only matches once per iteration per string. |
... |
additional arguments are ignored. |
This function is intended to test for unescaped whitespace characters in a regular expression pattern match string, and replace them with escaped whitespace characters, possibly expanding the allowed whitespace characters in the process.
Other jam string functions:
sortSamples()
,
strsplitOrdered()
x <- c("one two three", "one[ ]two three", "one[ 12] two three");
escapeWhitespaceRegexp(x);
# side-by-side summary of input and output
data.frame(input=paste0('"', x, '"'),
output=paste0('"', escapeWhitespaceRegexp(x), '"'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.