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.
pcretest -Cand it will tell you if you have unicode properties support enabled - Barry Chapman 2012-04-04 20:45
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
try preg_match("/\b(word1|word2)\b/iu", utf8_decode('text text text word1 text text'));