str_extract {stRoke}R Documentation

Extract string based on regex pattern

Description

Use base::strsplit to

Usage

str_extract(d, pattern)

Arguments

d

vector of character strings

pattern

regex pattern to match

Value

vector of character strings

Examples

ls <- do.call(c,lapply(sample(4:8,20,TRUE),function(i){
paste(sample(letters,i,TRUE),collapse = "")}))
ds <- do.call(c,lapply(1:20,function(i){
paste(sample(ls,1),i,sample(ls,1),"23",sep = "_")}))
str_extract(ds,"([0-9]+)")

[Package stRoke version 23.9.1 Index]