Count all pattern matches in character vector.

chr_count(x, pat, ignore.case = FALSE, invert = FALSE, ...)

Arguments

x

Character vector

pat

Pattern (regex) to extract from text.

ignore.case

Logical indicating whether to ignore capitalization. Defaults to false.

invert

Logical indicating whether to extract matching portion (default) or, if this value is true, non-matching portions of text.

...

Other named arguments passed to gregexpr.

Value

Vector of matches extracted from input text.