preg_match("/\b(word1|word2)\b/iu", 'text text text word1 text text');
的preg_match UTF-8的问题
出于某种原因,上面的代码不会与希伯来文字符中的一个服务器上运行,但会在另外一个工作。可能是什么原因?
preg_match("/\b(word1|word2)\b/iu", 'text text text word1 text text');
的preg_match UTF-8的问题
出于某种原因,上面的代码不会与希伯来文字符中的一个服务器上运行,但会在另外一个工作。可能是什么原因?
你有perl兼容正则表达式(PCRE)与Unicode支持启用的属性?那将是我的猜测。
尝试preg_match(“/ \ b(word1 | word2)\ b/iu”,utf8_decode('text text text1 text text'));
这不会解决问题。 – 2012-04-04 20:46:18
您需要Perl兼容的正则表达式(PCRE)3.9版本,至少你的服务器上能够有UTF-8字符图案preg_match()
功能
为了找到答案,在shell - 型'pcretest -C '它会告诉你是否启用了unicode属性支持。 – 2012-04-04 20:45:37
编译为 UTF-8支持 Unicode属性支持 – Lior 2012-04-04 20:49:30
在两台服务器上? – 2012-04-04 20:51:32