function Parser::consumeRegex
Consumes the given regex
Parameters
string $regex Regex to consume:
Return value
mixed|null
2 calls to Parser::consumeRegex()
- Parser::parseLiteralNumber in vendor/
mck89/ peast/ lib/ Peast/ Selector/ Parser.php - Parses a literal number
- Parser::parseSelectorPartPseudo in vendor/
mck89/ peast/ lib/ Peast/ Selector/ Parser.php - Parses a pseudo selector part
File
-
vendor/
mck89/ peast/ lib/ Peast/ Selector/ Parser.php, line 457
Class
- Parser
- Selector parser class
Namespace
Peast\SelectorCode
protected function consumeRegex($regex) {
if ($this->getChar() === null) {
return null;
}
if (!preg_match("#^({$regex})#", substr($this->selector, $this->index), $matches)) {
return null;
}
$this->index += strlen($matches[1]);
return $matches[1];
}