str_select: Select parts of a string, given patterns

View source: R/str_select.R

str_selectR Documentation

Select parts of a string, given patterns

Description

Select parts of a string: before, after or between patterns.

Usage

str_select(string, after = NULL, before = NULL)

Arguments

string

A character vector

after

A character single value (default = NULL), that will be the pattern to select after

before

A character single value (default = NULL), that will be the pattern to select before

Value

A character vector.

Examples


string <- "begin STRING1 TARGET STRING2 end"
#Select a string, before a pattern
str_select(string,before = "STRING2")

#Select a string, after a pattern
str_select(string,after = "STRING1")

#Select a string, between two patterns
str_select(string,"STRING1","STRING2")

vbfelix/relper documentation built on May 10, 2024, 10:50 p.m.