preg_match

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             $name = $tmp[1];

        }



        $accepted = @preg_match($this->filter, $name, $matches);



        if ($accepted && isset($this->filterMax)) {

            $set = end($matches);
<?php     private function setFilter(string $filter): void

    {

        if (@preg_match($filter, '') === false) {
<?php             if (preg_match('/^(.*?)#(\d+)(?:-(\d+))?$/', $filter, $matches)) {

                if (isset($matches[3]) && $matches[2] < $matches[3]) {

                    $filter = sprintf(

                        '%s.*with dataset #(\d+)$',
<?php             } // Handles:



            elseif (preg_match('/^(.*?)@(.+)$/', $filter, $matches)) {

                $filter = sprintf(

                    '%s.*with dataset "%s"$',

                    $matches[1],
<?php         if ($method->repetitions > 1) {

            $matches = [];

            preg_match('/\((.*?)\)/', $description, $matches);



            if (count($matches) > 1) {

                if (str_contains($description, 'with '.$matches[0].' /')) {
<?php             $message = "Failed asserting that {$value} is snake_case.";

        }



        Assert::assertTrue((bool) preg_match('/^[\p{Ll}_]+$/u', $value), $message);



        return $this;

    }
<?php             $message = "Failed asserting that {$value} is kebab-case.";

        }



        Assert::assertTrue((bool) preg_match('/^[\p{Ll}-]+$/u', $value), $message);



        return $this;

    }
<?php             $message = "Failed asserting that {$value} is camelCase.";

        }



        Assert::assertTrue((bool) preg_match('/^\p{Ll}[\p{Ll}\p{Lu}]+$/u', $value), $message);



        return $this;

    }
<?php             $message = "Failed asserting that {$value} is StudlyCase.";

        }



        Assert::assertTrue((bool) preg_match('/^\p{Lu}+\p{Ll}[\p{Ll}\p{Lu}]+$/u', $value), $message);



        return $this;

    }
<?php         $targets = array_map(function (string $path): string {

            $startChar = DIRECTORY_SEPARATOR;



            if ('\\' === DIRECTORY_SEPARATOR || preg_match('~\A[A-Z]:(?![^/\\\\])~i', $path) > 0) {

                $path = (string) preg_replace_callback('~^(?P<drive>[a-z]+:\\\)~i', fn (array $match): string => strtolower($match['drive']), $path);



                $startChar = strtolower((string) preg_replace('~^([a-z]+:\\\).*$~i', '$1', __DIR__));
<?php         $unexpectedOutput = $this->tail($outputFile);

        if ($unexpectedOutput !== '') {

            if (preg_match('/^T+$/', $unexpectedOutput) > 0) {

                return;

            }
<?php             return $closure();

        } catch (Throwable $throwable) {

            if (Str::startsWith($message = $throwable->getMessage(), self::UNDEFINED_METHOD)) {

                $class = preg_match('/^Call to undefined method ([^:]+)::/', $message, $matches) === false ? null : $matches[1];



                $message = str_replace(self::UNDEFINED_METHOD, 'Call to undefined method ', $message);
<?php     public static function isUuid(string $value): bool

    {

        return preg_match('/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iD', $value) > 0;

    }