R: Split strings using a regex

ore.split {ore} | R 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")

[Package ore version 1.6.0 Index]