stringr (version 0.3)

str_match: Extract first matched group from a string.

Description

Extract first matched group from a string.

Usage

str_match(string, pattern)

Arguments

string
input character vector
pattern
pattern to look for, as defined by a POSIX regular expression. Pattern should contain groups, defined by (). See the ``Extended Regular Expressions'' section of regex for details.

Value

  • character matrix. First column is the complete match, followed by one for each capture group

Details

Vectorised over string. pattern should be a single pattern, i.e. a character vector of length one.