Automattic\WooCommerce\Vendor\Pelago\Emogrifier\Utilities

Preg::matchpublicWC 1.0

Wraps preg_match. If an error occurs, and exceptions are not being thrown, zero (0) is returned, and if the $matches parameter is provided, it is set to an empty array. This method does not currently support the $flags or $offset parameters.

Метод класса: Preg{}

Хуков нет.

Возвращает

0|1.

Использование

$Preg = new Preg();
$Preg->match( $pattern, $subject, ?array $matches ): int;
$pattern(non-empty-string) (обязательный)
.
$subject(строка) (обязательный)
.
?array $matches(передается по ссылке — &)
.
По умолчанию: null

Код Preg::match() WC 11.0.1

public function match(string $pattern, string $subject, ?array &$matches = null): int
{
    $result = \preg_match($pattern, $subject, $matches);

    if ($result === false) {
        $this->logOrThrowPregLastError();
        $result = 0;
        $matches = [];
    }

    return $result;
}