Count the number of elements of a vector that match the pattern

count_pattern(vec, pattern, perl = TRUE)

Arguments

vec

A character vector

pattern

character string containing a regular expression.

perl

TRUE or FALSE

Value

An integer

Examples

count_pattern(c("aa", "ab", "ac"), "b")
#> [1] 1