ore_split: Split strings using a regex

ore_splitR Documentation

Split strings using a regex

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

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

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

ore documentation built on Jan. 17, 2023, 1:10 a.m.