reg_matches: regmatches()
with NA
Description
reg_matches()
is a thin wrapper around regmatches()
that returns
NA
instead of character(0)
when matching fails.
Usage
reg_matches(x, m, invert = FALSE)
Value
A list of character vectors with the matched substrings, or NA
if
matching failed.
Arguments
- x
A character vector.
- m
An object with match data.
- invert
A logical scalar. If TRUE
, extract or replace the non-matched
substrings.