Automattic\WooCommerce\Vendor\Pelago\Emogrifier\Utilities
Preg::match
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.
Method of the class: Preg{}
No Hooks.
Returns
0|1.
Usage
$Preg = new Preg(); $Preg->match( $pattern, $subject, ?array $matches ): int;
- $pattern(non-empty-string) (required)
- .
- $subject(string) (required)
- .
- ?array $matches(passed by reference — &)
- .
Default:null
Preg::match() Preg::match code WC 10.7.0
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;
}