Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return array entries that match the pattern
<?php preg_grep(string $pattern, array $array, int $flags = 0): array|false
<?php         }



        return $this->getGuarded() == ['*'] ||

               ! empty(preg_grep('/^'.preg_quote($key, '/').'$/i', $this->getGuarded())) ||

               ! $this->isGuardableColumn($key);

    }
<?php         $data = Arr::except($this->getDistinctValues($attribute), $attribute);



        if (in_array('ignore_case', $parameters)) {

            return empty(preg_grep('/^'.preg_quote($value, '/').'$/iu', $data));

        }



        return ! in_array($value, array_values($data), in_array('strict', $parameters));
<?php             if ($this->excludeUnvalidatedArrayKeys &&

                in_array('array', $rules) &&

                $value !== null &&

                ! empty(preg_grep('/^'.preg_quote($key, '/').'\.+/', array_keys($this->getRules())))) {

                continue;

            }