You are here

public function QueryPath::filterPreg in QueryPath 6

Same name and namespace in other branches
  1. 7.3 QueryPath/QueryPath.php \QueryPath::filterPreg()
  2. 7.2 QueryPath/QueryPath.php \QueryPath::filterPreg()

File

QueryPath/QueryPath.php, line 488

Class

QueryPath

Code

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