prege_grep is a PHP function to filter array entries that match a regular expression.
prege_grep()
is a php function to filter array entries that match a perl-compatible regular expression (pcre).
array preg_grep ( string $pattern , array $input [, int $flags = 0 ] )
Example
$arr = ["a", 1, "b", 2];
$newArr = preg_grep("/[a-z]/", $array);
print_r($newArr);
Result
Array (
[0] => a
[2] => b
)