src/Str.php
public function pregSplit(string $regex, int $limit = -1): StreamInterface
    {
        $strings = \preg_split($regex, $this->value, $limit);
        $stream = new Stream(self::class);

        foreach ($strings as $string) {
            $stream = $stream->add(new self($string, $this->encoding));
        }

        return $stream;
    }
public function pregSplit(string $regex, int $limit = -1): StreamInterface
    {
        $strings = \preg_split($regex, $this->value, $limit);
        $stream = new Stream(self::class);

        foreach ($strings as $string) {
            $stream = $stream->add(new self($string, $this->encoding));
        }

        return $stream;
    }
public function pregSplit ( string $ regex , int $ limit = - 1 ) : StreamInterface { $ strings = \ preg_split ( $ regex , $ this -> value , $ limit ) ; $ stream = new Stream ( self :: class ) ; foreach ( $ strings as $ string ) { $ stream = $ stream -> add ( new self ( $ string , $ this -> encoding ) ) ; } return $ stream ; }
Split the string using a regular expression

@param string $regex
@param int $limit

@return StreamInterface<self>
Split the string using a regular expression