preg_match("/\b(word1|word2)\b/iu", 'text text text word1 text text');
For some reason the above code doesn't work with Hebrew characters on one server, but does work on another one. What could be the cause?
Do you have perl compatible regular expressions (PCRE) with unicode properties support enabled? that would be my guess.
You need Perl Compatible Regular Expression (PCRE) version 3.9 at least on your server to be able to have UTF-8 characters in pattern with preg_match()
function
try preg_match("/\b(word1|word2)\b/iu", utf8_decode('text text text word1 text text'));
pcretest -C
and it will tell you if you have unicode properties support enabled - Barry Chapman 2012-04-04 20:45