Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Perform a regular expression match
<?php preg_match( string $pattern, string $subject, array &$matches = null, int $flags = 0, int $offset = 0): int|false
<?php static function insertAttributesIntoHtmlRoot($html, $attributes) {
$attributesFormattedForHtmlElement = static::stringifyHtmlAttributes($attributes);
preg_match('/(?:\n\s*|^\s*)<([a-zA-Z0-9\-]+)/', $html, $matches, PREG_OFFSET_CAPTURE);
throw_unless(
count($matches),
<?php public function isClassNameValid($name)
{
return preg_match("/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$/", $name);
}
public function isReservedClassName($name)
<?php if (preg_match('/filename\*=utf-8\'\'(.+)$/i', $header, $matches)) {
return rawurldecode($matches[1]);
}
<?php return rawurldecode($matches[1]);
}
if (preg_match('/.*?filename="(.+?)"/', $header, $matches)) {
return $matches[1];
}
<?php return $matches[1];
}
if (preg_match('/.*?filename=([^; ]+)/', $header, $matches)) {
return $matches[1];
}
<?php if (preg_match($openingDirectivesPattern, $match[0])) {
$template = static::prefixOpeningDirective($match[0], $template);
} elseif (preg_match($closingDirectivesPattern, $match[0])) {
$template = static::suffixClosingDirective($match[0], $template);
<?php if (preg_match($openingDirectivesPattern, $match[0])) {
$template = static::prefixOpeningDirective($match[0], $template);
} elseif (preg_match($closingDirectivesPattern, $match[0])) {
$template = static::suffixClosingDirective($match[0], $template);
}
}
<?php if ($parent) {
if (config('app.debug')) trigger('profile', 'child:'.$component->getId(), $parent->getId(), [$start, microtime(true)]);
preg_match('/<([a-zA-Z0-9\-]*)/', $html, $matches, PREG_OFFSET_CAPTURE);
$tag = $matches[1][0];
static::setParentChild($parent, $key, $tag, $component->getId());
}
<?php }
return $request->route($model, null) ??
((preg_match("/^['\"](.*)['\"]$/", trim($model), $matches)) ? $matches[1] : null);
}
<?php protected function extractChannelKeys($pattern, $channel)
{
preg_match('/^'.preg_replace('/\{(.*?)\}/', '(?<$1>[^\.]+)', $pattern).'/', $channel, $keys);
return $keys;
}
<?php protected function channelNameMatchesPattern($channel, $pattern)
{
return preg_match('/^'.preg_replace('/\{(.*?)\}/', '([^\.]+)', $pattern).'$/', $channel);
}
<?php }
foreach ($this->files->files($storagePath) as $file) {
if (preg_match('/facade-.*\.php$/', $file)) {
$this->files->delete($file);
}
}
<?php protected function sortImports($stub)
{
if (preg_match('/(?P<imports>(?:^use [^;{]+;$\n?)+)/m', $stub, $match)) {
$imports = explode("\n", trim($match['imports']));
sort($imports);
<?php protected static function name(string $expression)
{
if (! preg_match('/[^\s]+/', $expression, $matches)) {
throw new InvalidArgumentException('Unable to determine command name from signature.');
}
<?php $options = [];
foreach ($tokens as $token) {
if (preg_match('/^-{2,}(.*)/', $token, $matches)) {
$options[] = static::parseOption($matches[1]);
} else {
$arguments[] = static::parseArgument($token);