ansi_grep | R Documentation |
base::grep()
and base::grepl()
, but for ANSI stringsFirst ANSI sequences will be stripped with ansi_strip()
, both
ansi_grep(pattern, x, ignore.case = FALSE, perl = FALSE, value = FALSE, ...)
ansi_grepl(pattern, x, ...)
pattern |
Character scalar, regular expression or fixed string
(if |
x |
Character vector to search in. Other objects will be coerced
using |
ignore.case , perl , value |
Passed to |
... |
Extra arguments are passed to |
Note that these functions work on code points (or bytes if
useBytes = TRUE
), and not graphemes.
Unlike base::grep()
and base::grepl()
these functions do not special
case factors.
Both pattern
and x
are converted to UTF-8.
The same as base::grep()
and base::grepl()
, respectively.
red_needle <- col_red("needle")
haystack <- c("foo", "needle", "foo")
green_haystack <- col_green(haystack)
ansi_grepl(red_needle, haystack)
ansi_grepl(red_needle, green_haystack)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.