Learn R Programming

ore (version 1.7.4.1)

ore_split: 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)

Value

A character vector or list of substrings.

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.

See Also

ore_search

Examples

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

Run the code above in your browser using DataLab