正则表达式:在文章中有好多<font color=red>...</font>,怎么全部去掉呢?

正则表达式:在文章中有好多

1<font color="red">...</font>

,怎么全部去掉呢?怎么来写正则表达式?
---------------------------------------------------------------

1   
2echo preg_replace('/

<font.*?font>/','','正则表达式:在文章中有好多<font color="red">...</font>,怎么全部去掉呢?怎么来写正则表达式?正则表达式:在文章中有好多<font color="red">...</font>,怎么全部去掉呢?怎么来写正则表达式?');

1\---------------------------------------------------------------   
2  

$s = "正则表达式:在文章中有好多<font color="red">...</font>,怎么全部去掉呢?怎么来写正则表达式?正则表达式:在文章中有好多<font color="red">...</font>,怎么全部去掉呢?怎么来写正则表达式?";

//你想得到这样的效果
echo preg_replace("/<font .*="" font="">/iU","",$s);
//正则表达式:在文章中有好多,怎么全部去掉呢?怎么来写正则表达式?正则表达式:在文章中有好多,怎么全部去掉呢?怎么来写正则表达式?
echo "<br/>";

//还是这样的效果
echo preg_replace("/&lt;/?font.*&gt;/iU","",$s);
//正则表达式:在文章中有好多...,怎么全部去掉呢?怎么来写正则表达式?正则表达式:在文章中有好多...,怎么全部去掉呢?怎么来写正则表达式?

Published At
Categories with Web编程
Tagged with
comments powered by Disqus