ore_split: Split strings using a regex

Description Usage Arguments Value See Also Examples

Description

This function breaks up the strings provided at regions matching a regular expression, removing those regions from the result. It is analogous to the strsplit function in base R.

Usage

1
ore_split(regex, text, start = 1L, simplify = TRUE)

Arguments

regex

A single character string or object of class "ore". In the former case, this will first be passed through ore.

text

A vector of strings to match against.

start

An optional vector of offsets (in characters) at which to start searching. Will be recycled to the length of text.

simplify

If TRUE, a character vector containing the pieces will be returned if text is of length 1. Otherwise, a list of such objects will always be returned.

Value

A character vector or list of substrings.

See Also

ore_search

Examples

1
ore_split("-?\\d+", "I have 2 dogs, 3 cats and 4 hamsters")

ore documentation built on Nov. 2, 2021, 5:08 p.m.