Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP、preg_replace&;的问题;正则表达式_Php_Regex_Preg Replace - Fatal编程技术网

PHP、preg_replace&;的问题;正则表达式

PHP、preg_replace&;的问题;正则表达式,php,regex,preg-replace,Php,Regex,Preg Replace,我正在尝试运行以下php命令: preg_replace($regexp, $replace, $text, $maxsingle); 其中VAR为: $regexp = '/(?!(?:[^<\\[]+[>\\]]|[^>\\]]+<\\/a>))\\b(שלום)\\b/imsU'; $replace = '<a title="$1" href="http://stackoverflow.com">$1</a>'; $text is a

我正在尝试运行以下php命令:

preg_replace($regexp, $replace, $text, $maxsingle);
其中VAR为:

$regexp = '/(?!(?:[^<\\[]+[>\\]]|[^>\\]]+<\\/a>))\\b(שלום)\\b/imsU';
$replace = '<a title="$1" href="http://stackoverflow.com">$1</a>';
$text is a long post
$maxsingle = 3;
$regexp='/(?!(?:[^\\]]|[^>\\]]+)\\b(ש1500;ום)\\b/imsU';
$replace='';
$text是一篇长文章
$maxsingle=3;
当我试图匹配的文本(在上面的例子中是“שלום”)是英语时,一切都正常。但是,当文本是希伯来语时,它与任何内容都不匹配

有没有办法让希伯来语与
preg_replace
一起使用


谢谢。

尝试使用/u(utf-8)标志

嘿,谢谢你的回答。我应该把它放在哪里?你能把确切的regexp粘贴给我吗?谢谢。$regexp='/(?!(?:[^\\]].[^>\\]]+)\\b(ש1500;ום)\\b/imsuU';