public function filter($pattern)
    {
        return new self(array_filter($this->items, function (AcceptHeaderItem $item) use ($pattern) {
            return preg_match($pattern, $item->getValue());
        }));
    }
public function filter($pattern)
    {
        return new self(array_filter($this->items, function (AcceptHeaderItem $item) use ($pattern) {
            return preg_match($pattern, $item->getValue());
        }));
    }
public function filter ( $ pattern ) { return new self ( array_filter ( $ this -> items , function ( AcceptHeaderItem $ item ) use ( $ pattern ) { return preg_match ( $ pattern , $ item -> getValue ( ) ) ; } ) ) ; }
Filters items on their value using given regex.

@param string $pattern

@return self
Filters items on their value using given regex .