grapes-grapes: Remove pattern matches

Description Usage Arguments Details Value Functions Examples

Description

Remove a pattern match from a string. Think of this as regex-powered string subtraction. Matching is case-insensitive and greedy, i.e., all matches will be removed.

Usage

1
2
3
string %-% pattern

string %r% pattern

Arguments

string

A character vector.

pattern

A regular expression.

Details

The equivalent alternatives are str_remove_all(x, regex(pattern, ignore_case = TRUE)) (which this function wraps) or gsub('pattern', '', x, ignore.case = TRUE).

Value

The vector string without any substrings matching pattern.

Functions

Examples

1
2
'APPLE' %-% 'l\\w' == 'APP'
'BANANA' %-% 'a|n' == 'B'

MEDSL/medslcleaner documentation built on May 31, 2019, 7:39 a.m.