First ANSI sequences will be stripped with ansi_strip()
, both
Usage
ansi_grep(pattern, x, ignore.case = FALSE, perl = FALSE, value = FALSE, ...)
ansi_grepl(pattern, x, ...)
Arguments
- pattern
Character scalar, regular expression or fixed string (if
fixed = TRUE
), the pattern to search for. Other objects will be coerced usingas.character()
.- x
Character vector to search in. Other objects will be coerced using
as.character()
.- ignore.case, perl, value
Passed to
base::grep()
.- ...
Extra arguments are passed to
base::grep()
orbase::grepl()
.
Value
The same as base::grep()
and base::grepl()
, respectively.
Details
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.