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     protected function getClassAndMethodFromExceptionMessage(string $message): ?array

    {

        if (! preg_match(self::REGEX, $message, $matches)) {

            return null;

        }
<?php             return false;

        }



        if (! preg_match(self::REGEX, $throwable->getMessage(), $matches)) {

            return false;

        }
<?php     public function getSolutions(Throwable $throwable): array

    {

        preg_match(self::REGEX, $throwable->getMessage(), $matches);



        $invalidController = $matches[1] ?? null;
<?php     public function getSolutions(Throwable $throwable): array

    {

        $file = file_get_contents($throwable->getFile());

        preg_match('/\>\>\>\>\>\>\> (.*?)\n/', $file, $matches);

        $source = $matches[1];



        $target = $this->getCurrentBranch(basename($throwable->getFile()));
<?php     {

        $pattern = '/Class \'([^\s]+)\' not found/m';



        if (! preg_match($pattern, $throwable->getMessage(), $matches)) {

            return false;

        }
<?php     {

        $pattern = '/Class \'([^\s]+)\' not found/m';



        if (! preg_match($pattern, $throwable->getMessage(), $matches)) {

            return false;

        }
<?php             }

        }



        return (bool)preg_match(self::REGEX, $throwable->getMessage(), $matches);

    }



    public function getSolutions(Throwable $throwable): array
<?php     public function getSolutions(Throwable $throwable): array

    {

        preg_match(self::REGEX, $throwable->getMessage(), $matches);



        $missingRoute = $matches[1] ?? null;
<?php     protected function getClassAndPropertyFromExceptionMessage(string $message): ?array

    {

        if (! preg_match(self::REGEX, $message, $matches)) {

            return null;

        }
<?php     {

        $pattern = '/Undefined variable:? (.*?) \(View: (.*?)\)/';



        preg_match($pattern, $throwable->getMessage(), $matches);



        if (count($matches) === 3) {

            [, $variableName, $viewFile] = $matches;
<?php     protected function getMethodFromExceptionMessage(string $message): ?string

    {

        if (! preg_match(self::REGEX, $message, $matches)) {

            return null;

        }
<?php         return Collection::make($class->getMethods())

            ->filter(function (ReflectionMethod $method) {

                return preg_match('/(validate(?!(Attribute|UsingCustomRule))[A-Z][a-zA-Z]+)/', $method->name);

            })

            ->map(function (ReflectionMethod $method) {

                return $method->name;
<?php             return false;

        }



        return (bool)preg_match(self::REGEX, $throwable->getMessage(), $matches);

    }



    public function getSolutions(Throwable $throwable): array
<?php     public function getSolutions(Throwable $throwable): array

    {

        preg_match(self::REGEX, $throwable->getMessage(), $matches);



        $missingView = $matches[1] ?? null;
<?php         $line = $map[$exceptionLineNumber - 1] ?? $exceptionLineNumber;

        $pattern = '/\|---LINE:([0-9]+)---\|/m';



        if (preg_match($pattern, (string)$line, $matches)) {

            return (int)$matches[1];

        }