str_match_all

0th

Percentile

Extract all matched groups from a string.

Extract all matched groups from a string.

Keywords
character
Usage
str_match_all(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.
Details

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

Value

  • list of character matrices, as given by str_match

Aliases
  • str_match_all
Examples
strings <- c("Home: 219 733 8965.  Work: 229-293-8753 ", 
"banana pear apple", "595 794 7569 / 387 287 6718")
phone <- "([2-9][0-9]{2})[- .]([0-9]{3})[- .]([0-9]{4})"

str_extract_all(strings, phone)
str_match_all(strings, phone)
Documentation reproduced from package stringr, version 0.5, License: GPL-2

Community examples

Looks like there are no examples yet.