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

Breadcrumb

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

function Preg::match

@param-out array<int|string, string|null> $matches

Parameters

non-empty-string $pattern:

array<mixed> $matches Set by method:

int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported:

Return value

0|1

7 calls to Preg::match()
InvalidRegexPatternRule::validatePattern in vendor/composer/pcre/src/PHPStan/InvalidRegexPatternRule.php
JsonManipulator::addSubNode in vendor/composer/composer/src/Composer/Json/JsonManipulator.php
JsonManipulator::removeSubNode in vendor/composer/composer/src/Composer/Json/JsonManipulator.php
Preg::isMatch in vendor/composer/pcre/src/Preg.php
Variant of match() which returns a bool instead of int
Preg::matchStrictGroups in vendor/composer/pcre/src/Preg.php
Variant of `match()` which outputs non-null matches (or throws)

... See full list

File

vendor/composer/pcre/src/Preg.php, line 29

Class

Preg

Namespace

Composer\Pcre

Code

public static function match(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0) : int {
    self::checkOffsetCapture($flags, 'matchWithOffsets');
    $result = preg_match($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset);
    if ($result === false) {
        throw PcreException::fromFunction('preg_match', $pattern);
    }
    return $result;
}
RSS feed
Powered by Drupal