multi-byte function to replace preg_match_all?

PHP: preg_grep manual

$matches = preg_grep('/(needles|to|find)/u', $inputArray);

Returns an array indexed using the keys from the input array.

Note the /u modifier which enables multibyte support.

Hope it helps others.


Have you taken a look into mb_ereg?

Additionally, you can pass an UTF-8 encoded string into preg_match using the u modifier, which might be the kind of multi-byte support you need. The other option is to encode into UTF-8 and then encode the results back.

See as well an answer to a related question: Are the PHP preg_functions multibyte safe?