powered by
base::grep()
base::grepl()
First ANSI sequences will be stripped with ansi_strip(), both
ansi_strip()
ansi_grep(pattern, x, ignore.case = FALSE, perl = FALSE, value = FALSE, ...)ansi_grepl(pattern, x, ...)
ansi_grepl(pattern, x, ...)
The same as base::grep() and base::grepl(), respectively.
Character scalar, regular expression or fixed string (if fixed = TRUE), the pattern to search for. Other objects will be coerced using as.character().
fixed = TRUE
as.character()
Character vector to search in. Other objects will be coerced using as.character().
Passed to base::grep().
Extra arguments are passed to base::grep() or base::grepl().
Note that these functions work on code points (or bytes if useBytes = TRUE), and not graphemes.
useBytes = TRUE
Unlike base::grep() and base::grepl() these functions do not special case factors.
Both pattern and x are converted to UTF-8.
pattern
x
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)
Run the code above in your browser using DataLab