<p>php正则过滤html标签、空格、换行符的代码(附说明) //过滤中文开始<br />
$str = '7501yu1298中人bbce国yy2008';<br />
$par = "/[x80-xff]/";<br />
echo preg_replace($par,"",$str);//过滤中文结束</p>
<p>$content=preg_replace("/s+/", " ", $content); //过滤多余回车</p>
<p><br />
$content=preg_replace("/<[ ]+/si","<",$content); //过滤<__("<"号后面带空格)</p>
<p><br />
$content=preg_replace("/<!--.*?-->/si","",$content); //注释</p>
<p><br />
$content=preg_replace("/<(!.*?)>/si","",$content); //过滤DOCTYPE</p>
<p><br />
$content=preg_replace("/<(/?html.*?)>/si","",$content); //过滤html标签</p>
<p><br />
$content=preg_replace("/<(/?head.*?)>/si","",$content); //过滤head标签</p>
<p><br />
$content=preg_replace("/<(/?meta.*?)>/si","",$content); //过滤meta标签</p>
<p><br />
$content=preg_replace("/<(/?body.*?)>/si","",$content); //过滤body标签</p>
<p><br />
$content=preg_replace("/<(/?link.*?)>/si","",$content); //过滤link标签</p>
<p><br />
$content=preg_replace("/<(/?form.*?)>/si","",$content); //过滤form标签</p>
<p><br />
$content=preg_replace("/cookie/si","COOKIE",$content); //过滤COOKIE标签</p>
<p><br />
$content=preg_replace("/<(applet.*?)>(.*?)<(/applet.*?)>/si","",$content); //过滤applet标签<br />
$content=preg_replace("/<(/?applet.*?)>/si","",$content); //过滤applet标签</p>
<p><br />
$content=preg_replace("/<(style.*?)>(.*?)<(/style.*?)>/si","",$content); //过滤style标签<br />
$content=preg_replace("/<(/?style.*?)>/si","",$content); //过滤style标签</p>
<p><br />
$content=preg_replace("/<(title.*?)>(.*?)<(/title.*?)>/si","",$content); //过滤title标签<br />
$content=preg_replace("/<(/?title.*?)>/si","",$content); //过滤title标签</p>
<p><br />
$content=preg_replace("/<(object.*?)>(.*?)<(/object.*?)>/si","",$content); //过滤object标签<br />
$content=preg_replace("/<(/?objec.*?)>/si","",$content); //过滤object标签</p>
<p><br />
$content=preg_replace("/<(noframes.*?)>(.*?)<(/noframes.*?)>/si","",$content); //过滤noframes标签<br />
$content=preg_replace("/<(/?noframes.*?)>/si","",$content); //过滤noframes标签</p>
<p><br />
$content=preg_replace("/<(i?frame.*?)>(.*?)<(/i?frame.*?)>/si","",$content); //过滤frame标签<br />
$content=preg_replace("/<(/?i?frame.*?)>/si","",$content); //过滤frame标签</p>
<p><br />
$content=preg_replace("/<(script.*?)>(.*?)<(/script.*?)>/si","",$content); //过滤script标签<br />
$content=preg_replace("/<(/?script.*?)>/si","",$content); //过滤script标签<br />
$content=preg_replace("/javascript/si","Javascript",$content); //过滤script标签<br />
$content=preg_replace("/vbscript/si","Vbscript",$content); //过滤script标签</p>
<p></p>