public function filterPreg($regex) { $found = new \SplObjectStorage(); foreach ($this->matches as $item) { if (preg_match($regex, $item->textContent) > 0) { $found->attach($item); } } return $this->inst($found, null, $this->options); }