str_match: Extract matching groups

View source: R/match.R

str_matchR Documentation

Extract matching groups

Description

Extract matching groups

Usage

str_match(string, pattern)

Arguments

string

Character vector of strings.

pattern

A pattern to match. Can be:

  • A single string or regex(), to use POSIX 1003.2 extended regular expression.

  • fixed() to use a fixed/literal matchi.

  • perl() to use a Perl-compatible regular expression.

Unlike stringr, pattern must be length 1; it will not be recycled to the same length as string.

Value

A character matrix with one row for each element of string. The first column gives the complete match; the remaining columns give the component of each match group (formed by ⁠()⁠).


hadley/stringb documentation built on Sept. 16, 2023, 9:11 p.m.