str_group_extract {dsmisc}R Documentation

Extract Regular Expression Groups

Description

Extract Regular Expression Groups

Usage

str_group_extract(string, pattern, group = NULL, nas = TRUE)

Arguments

string

string to extract from

pattern

pattern with groups to match

group

groups to extract

nas

return NA values (TRUE) or filter them out (FALSE)

Value

string vector or string matrix

Examples


strings <- paste(LETTERS, seq_along(LETTERS), sep = "_")
str_group_extract(strings, "([\\w])_(\\d+)")
str_group_extract(strings, "([\\w])_(\\d+)", 1)
str_group_extract(strings, "([\\w])_(\\d+)", 2)


[Package dsmisc version 0.3.3 Index]