Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

str_group_extract

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)

dsmisc

Data Science Box of Pandora Miscellaneous

v0.3.3
GPL (>= 2)
Authors
Peter Meissner [aut, cre]
Initial release
2020-09-11

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.