chr_subset returns a subset of the input character vector, containing only the elements that match a specified pattern.
Arguments
- strings
 A character vector, where each element of the vector is a character string.
- pattern
 A single character string to be searched for in each element of
strings. By default,patternis interpreted as a regular expression (regex). If thefixedargument is set toTRUE,patternwill be treated as a literal string to be matched exactly.- fixed
 Logical; whether
patternshould be matched exactly, treating regex special characters as regular string characters. DefaultFALSE.
Value
A character vector containing only the elements of strings that match the specified pattern. If no matches are found, an empty character vector is returned.
Details
These functions are built using the base R regular expression functions.
{suitestrings} uses Perl-compatible Regular Expressions (PCRE).
This is achieved by setting perl = TRUE in the underlying base functions.
See R's regexp documentation for info on the regex implementation.
For complete syntax details see https://www.pcre.org/current/doc/html/