QueryPath\DOMQuery::filterPreg PHP Method

filterPreg() public method

Only items that match the given regular expression will be kept. All others will be removed. The regular expression is run against the text content (the PCDATA) of the elements. This is a way of filtering elements based on their content. Example:
See also: filter()
See also: filterCallback()
See also: preg_match()
public filterPreg ( string $regex )
$regex string A regular expression.
    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);
    }