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         $changed = collect(Arr::dot($bardPayload))

            ->filter(function ($value, $key) {

                return preg_match('/(.*)\.(type)/', $key) && $value === 'image';

            })

            ->mapWithKeys(function ($value, $key) use ($bardPayload) {

                $key = str_replace('.type', '.attrs.src', $key);
<?php         $changed = collect(Arr::dot($bardPayload))

            ->filter(function ($value, $key) {

                return preg_match('/(.*)\.(type)/', $key) && $value === 'link';

            })

            ->mapWithKeys(function ($value, $key) use ($bardPayload) {

                $key = str_replace('.type', '.attrs.href', $key);
<?php     {

        $pattern = preg_quote(config('statamic.cp.route'), '#').'/'.$this->active;



        return preg_match('#'.$pattern.'#', request()->decodedPath()) === 1;

    }
<?php     private function isDate($str)

    {

        return preg_match('/^\d{4}-\d{2}-\d{2}(-\d{4})?$/', $str);

    }

}
<?php     private function isDate($str)

    {

        return preg_match('/^\d{4}-\d{2}-\d{2}(-\d{4})?$/', $str);

    }

}
<?php     private function isDate($str)

    {

        return preg_match('/^\d{4}-\d{2}-\d{2}(-\d{4})?$/', $str);

    }

}
<?php         $data = [];

        $content = $string;



        if (preg_match('/^---[\r\n?|\n]/', $string)) {

            $data = self::YAML($string);

            $content = $data['content'];

            unset($data['content']);
<?php         }




        preg_match('/{env:(.*)\s?}/', $val, $matches);



        if (! isset($matches[0])) {
<?php     public function isAbsolute($path)

    {

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

    }
<?php             ? "#/__(?:\d+\.)?[\w-]+/(?:\w+\.)?index\.{$ext}$#"

            : "#/__[\w\._-]+\.{$ext}$#";



        return (bool) preg_match($pattern, $path);

    }
<?php             ? "#/_(?!_)(?:\d+\.)?[\w-]+/(?:\w+\.)?index\.{$ext}$#"

            : "#/_(?!_)[\w\._-]+\.{$ext}$#";



        return (bool) preg_match($pattern, $path);

    }
<?php     public function isUUID($value)

    {

        return (bool) preg_match($this->uuid(), $value);

    }

}
<?php         $nullable = true;



        foreach ($rules as $rule) {

            if (is_string($rule) && preg_match('/^required_?/', $rule)) {

                $nullable = false;

                break;

            }
<?php         $arr = preg_split('/(<set>index-\d+<\/set>)/', $html, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);



        return collect($arr)->map(function ($html) {

            if (preg_match('/^<set>index-(\d+)<\/set>/', $html, $matches)) {

                return $this->sets[$matches[1]];

            }
<?php             $email = trim($address);



            if (Str::contains($email, '<')) {

                preg_match('/^(.*) \<(.*)\>$/', $email, $matches);

                $name = $matches[1];

                $email = $matches[2];

            }