function Preg::matchWithOffsets
Runs preg_match with PREG_OFFSET_CAPTURE
@param-out array<int|string, array{string|null, int<-1, max>}> $matches
Parameters
non-empty-string $pattern:
array<mixed> $matches Set by method:
int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_UNMATCHED_AS_NULL and PREG_OFFSET_CAPTURE are always set, no other flags are supported:
Return value
0|1
2 calls to Preg::matchWithOffsets()
- Preg::isMatchWithOffsets in vendor/
composer/ pcre/ src/ Preg.php - Variant of matchWithOffsets() which returns a bool instead of int
- Regex::matchWithOffsets in vendor/
composer/ pcre/ src/ Regex.php - Runs preg_match with PREG_OFFSET_CAPTURE
File
-
vendor/
composer/ pcre/ src/ Preg.php, line 70
Class
Namespace
Composer\PcreCode
public static function matchWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0) : int {
$result = preg_match($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL | PREG_OFFSET_CAPTURE, $offset);
if ($result === false) {
throw PcreException::fromFunction('preg_match', $pattern);
}
return $result;
}