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

Breadcrumb

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

function Preg::matchAll

@param-out array<int|string, list<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|positive-int

4 calls to Preg::matchAll()
PhpFileParser::findClasses in vendor/composer/class-map-generator/src/PhpFileParser.php
Extract the classes in the given file
Preg::isMatchAll in vendor/composer/pcre/src/Preg.php
Variant of matchAll() which returns a bool instead of int
Preg::matchAllStrictGroups in vendor/composer/pcre/src/Preg.php
Variant of `match()` which outputs non-null matches (or throws)
Regex::matchAll in vendor/composer/pcre/src/Regex.php

File

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

Class

Preg

Namespace

Composer\Pcre

Code

public static function matchAll(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0) : int {
    self::checkOffsetCapture($flags, 'matchAllWithOffsets');
    self::checkSetOrder($flags);
    $result = preg_match_all($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset);
    if (!is_int($result)) {
        // PHP < 8 may return null, 8+ returns int|false
        throw PcreException::fromFunction('preg_match_all', $pattern);
    }
    return $result;
}

API Navigation

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