Description Usage Arguments Details Value Examples
Uses 'backtick' (or another character or string) as an alias for 'backslash' in regex pattern strings,
1 | praw(pat, cesc = "`")
|
pat |
a string or character vector |
cesc |
a character or string (default ') to be substituted by double \ in the returned pattern string where any cescs appeared on input. |
Literal occurrences of characters such as ([.|)\^+$*?:] often need to be escaped
in regular expression patterns. This may make them look very different from, e.g.,
Python raw string patterns.
Thus, the equivalent of Python's pyPat= r'\(\s*\w+\s*\)' would have to look like:
rPat <- "\\(\\s*\\w+\\s*\\)". With praw() we can instead use
erPat <- ('`(`s*`w+`s*`)')
To match a literal single backslash in a string, pat <- praw('``') is necessary, generating the same
string as pat= '\\'.
To match a double literal backslash R would require an eight 'leaning toothpicks' pattern ('\\\\\\\\'), but with praw, we get away with
four backticks pat <- praw('````'), yielding \\\\\\\\.
If a literal backtick is in the pattern of interest, you can substitute another unused character to stand in for \\ sequences.
the pattern with the 'cesc' character replaced by two backslashes. See details.
1 2 3 4 5 6 7 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.