src/Collection.php
public function match($regex)
    {
        $col = new static();

        foreach ($this as $key => $value) {
            if (\preg_match($regex, $key)) {
                $col[$key] = $value;
            }
        }

        return $col;
    }
public function match($regex)
    {
        $col = new static();

        foreach ($this as $key => $value) {
            if (\preg_match($regex, $key)) {
                $col[$key] = $value;
            }
        }

        return $col;
    }
public function match ( $ regex ) { $ col = new static ( ) ; foreach ( $ this as $ key => $ value ) { if ( \ preg_match ( $ regex , $ key ) ) { $ col [ $ key ] = $ value ; } } return $ col ; }
Find keys and values using a regular expression, returning a new Collection

Similar to {@link keys} but allows any PERL regular expression to be
used for locating a matching key. Returns a new Collection containing matching
keys and values.

@param string $regex PERL regular expression

@return static
Find keys and values using a regular expression returning a new Collection