Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Parser.php

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\Selector

Code

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];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal