Replace matched patterns in a string

x %re% y.z

Arguments

x

A character vector

y.z

A vector of two string specifying pattern for match and replace

Value

A character vector

Details

This function is a pipe version of stringr::str_replace

Examples

'totoro12_13' %re% c('[0-9]+', 'to')
#> [1] "totoroto_13"