View the result of the regular expression when applied to the given text.
The default behavior renders the result as HTML and opens the file in
the RStudio viewer pane. If render
is FALSE
, the HTML itself is returned.
If the output is destined for a knitr document, set knitr
to TRUE
.
view_regex(text, pattern, ..., render = TRUE, escape = render,
exact = escape, result_only = FALSE)
Text to search
Regex pattern to look for
Arguments passed on to base::regexec
if FALSE
, the pattern matching is case
sensitive and if TRUE
, case is ignored during matching.
logical. Should Perl-compatible regexps be used?
logical. If TRUE
, pattern
is a string to be
matched as is. Overrides all conflicting arguments.
logical. If TRUE
the matching is done
byte-by-byte rather than character-by-character. See
‘Details’.
Render results to an HTML doc and open in RStudio viewer?
Escape HTML-related characters in text
?
Should the regex pattern be displayed as entered by the user
into R console or source (default)? When TRUE
, regex is displayed with
the double \\
required for escaping backslashes in R. When FALSE
,
regex is displayed as interpreted by the regex engine (i.e. double \\
as a single \
).
Should only the result be displayed? If FALSE
, then
the colorized regular expression is also displayed in the output.
# NOT RUN {
view_regex("example", "amp", render=FALSE)
# }
Run the code above in your browser using DataLab