view_regex: View grouped regex results

Description Usage Arguments Examples

View source: R/regex.R

Description

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.

Usage

1
2
3
4
5
6
7
8
9
view_regex(
  text,
  pattern,
  ...,
  render = TRUE,
  escape = render,
  exact = escape,
  result_only = FALSE
)

Arguments

text

Text to search

pattern

Regex pattern to look for

...

Arguments passed on to base::regexec

ignore.case

if FALSE, the pattern matching is case sensitive and if TRUE, case is ignored during matching.

perl

logical. Should Perl-compatible regexps be used?

fixed

logical. If TRUE, pattern is a string to be matched as is. Overrides all conflicting arguments.

useBytes

logical. If TRUE the matching is done byte-by-byte rather than character-by-character. See ‘Details’.

render

Render results as HTML?

escape

Escape HTML-related characters in text?

exact

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 \\).

result_only

Should only the result be displayed? If FALSE, then the colorized regular expression is also displayed in the output.

Examples

1
view_regex("example", "amp", render = FALSE)

gadenbuie/regexhelp documentation built on June 1, 2021, 4:24 p.m.