You are here

protected function simple_html_dom_node::match in simplehtmldom API 7

Same name and namespace in other branches
  1. 5.2 simplehtmldom/simple_html_dom.php \simple_html_dom_node::match()
  2. 6 simplehtmldom/simple_html_dom.php \simple_html_dom_node::match()
1 call to simple_html_dom_node::match()
simple_html_dom_node::seek in simplehtmldom/simple_html_dom.php

File

simplehtmldom/simple_html_dom.php, line 366

Class

simple_html_dom_node

Code

protected function match($exp, $pattern, $value) {
  switch ($exp) {
    case '=':
      return $value === $pattern;
    case '!=':
      return $value !== $pattern;
    case '^=':
      return preg_match("/^" . preg_quote($pattern, '/') . "/", $value);
    case '$=':
      return preg_match("/" . preg_quote($pattern, '/') . "\$/", $value);
    case '*=':
      if ($pattern[0] == '/') {
        return preg_match($pattern, $value);
      }
      return preg_match("/" . $pattern . "/i", $value);
  }
  return false;
}