Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.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
Html PHP:替换字符–;在wordpress中后跟几个不间断的空格;“U内容”;_Html_Regex_Wordpress - Fatal编程技术网

Html PHP:替换字符–;在wordpress中后跟几个不间断的空格;“U内容”;

Html PHP:替换字符–;在wordpress中后跟几个不间断的空格;“U内容”;,html,regex,wordpress,Html,Regex,Wordpress,在Wordpress中,在自定义模板中,我有很多这样的行: <h3> <a name="_Toc531441816"></a> == 0 "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.2.1 -&nbsp;&nbsp;&nbsp;&nbsp;Blabla..." </h3> 与 我想我必须使用正则表达式,但我没有找到正确的表达式。我找不

在Wordpress中,在自定义模板中,我有很多这样的行:

<h3>
<a name="_Toc531441816"></a> == 0
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.2.1 -&nbsp;&nbsp;&nbsp;&nbsp;Blabla..."
</h3>

我想我必须使用正则表达式,但我没有找到正确的表达式。
我找不到如何搜索表达式
-
,以便将其替换为
-

谢谢你帮助我,
当做
Bruno

如果要替换的字符串正好是
您不需要正则表达式,您可以正常搜索并替换它


然而,正则表达式应该是替换字符串“–”和“的正确表达式● " 通过“–”和● “它们是: 对于“不可破坏空间”:$str=mb_ereg_replace('-(?:\xc2\xa0){4}','-',$str);
对于“黑圈”:$str=mb_ereg_replace('\xE2\x97\x8F(?:\xc2\xa0){4}','●', $str);

事实上,我在function.php中使用的代码是:function replace_text_wps($str){$str=preg_replace('/-/','+',$str);return$str;}add_filter('u content','replace_text_wps');没有任何变化。我认为我必须用unicode替换'-'。我尝试了chr(150)没有结果。我不知道该怎么做…这可能是一个吗?也许,我不知道。事实上,我尝试了chr(8212)=>不工作。你知道“preg\u replace”的正确表达式吗?我找到了要替换的代码“–”:–;我找到了要替换的代码“:\xc2\xa0我使用此代码替换“–”:函数替换\u text\u wps($str){$str=mb\u ereg\u replace(&-\8211;,“+”,$str);return$str;}add\u filter(“\u content”,“replace\u text\u wps”);你能帮我修复“–”(后跟4个不可破空格)的表达式吗?事实上,如何连接:&-\8211;“\xc2\xa0”“\xc2\xa0”“\xc2\xa0”““感谢您的帮助,正确的表达式是:$str=mb_ereg_replace('–;(?:\xc2\xa0){4}','+',$str);
&nbsp;&nbsp;`3.2.1 -&nbsp;&nbsp;&nbsp;&nbsp;Blabla...
&nbsp;&nbsp;`3.2.1 - Blabla...