src/Ciconia/Common/Text.php
public function split($pattern, $flags = PREG_SPLIT_DELIM_CAPTURE)
    {
        return new Collection(
            array_map(function ($item) {
                return new static($item);
            }, preg_split($pattern, $this->text, -1, $flags))
        );
    }
public function split($pattern, $flags = PREG_SPLIT_DELIM_CAPTURE)
    {
        return new Collection(
            array_map(function ($item) {
                return new static($item);
            }, preg_split($pattern, $this->text, -1, $flags))
        );
    }
Split string by a regular expression

@param string $pattern The pattern to search for, as a string.
@param int    $flags   [optional] PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_OFFSET_CAPTURE

@return Text[]|Collection