$str =preg_replace ("/\s+/", "", $str); Filter Excess return $str =preg_replace ("/<[]+/si", "<", $str); Filter <__ (with spaces behind "<") $str =preg_replace ("/<\!--. *?-->/si", "", $str); Note $str =preg_replace ("/< (\!. *?) >/si "," ", $str); Filter doctype $str =preg_replace ("/< (\/?html.*?) >/si "," ", $str); Filter HTML tags $str =preg_replace ("/< (\/?head.*?) >/si "," ", $str); Filter Head tag $str =preg_replace ("/< (\/?meta.*?) >/si "," ", $str); Filter META Tags $str =preg_replace ("/< (\/?body.*?) >/si "," ", $str); Filter body tag $str =preg_replace ("/< (\/?link.*?) >/si "," ", $str); Filter the link tag $str =preg_replace ("/< (\/?form.*?) >/si "," ", $str); Filter form Tags $str =preg_replace ("/cookie/si", "Cookie", $str); Filter Cookie Tags $str =preg_replace ("/< (applet.*?) > (. *?) < (\/applet.*?) >/si "," ", $str); Filter applet Tags $str =preg_replace ("/< (\/?applet.*?) >/si "," ", $str); Filter applet Tags $str =preg_replace ("/< (style.*?) > (. *?) < (\/style.*?) >/si "," ", $str); Filter the style label $str =preg_replace ("/< (\/?style.*?) >/si "," ", $stR); Filter the style label $str =preg_replace ("/< (title.*?) > (. *?) < (\/title.*?) >/si "," ", $str); Filter the title tag $str =preg_replace ("/< (\/?title.*?) >/si "," ", $str); Filter the title tag $str =preg_replace ("/< (object.*?) > (. *?) < (\/object.*?) >/si "," ", $str); Filter the OBJECT tag $str =preg_replace ("/< (\/?objec.*?) >/si "," ", $str); Filter the OBJECT tag $str =preg_replace ("/< (noframes.*?) > (. *?) < (\/noframes.*?) >/si "," ", $str); Filter Noframes Tags $str =preg_replace ("/< (\/?noframes.*?) >/si "," ", $str); Filter Noframes Tags $str =preg_replace ("/< (i?frame.*?) > (. *?) < (\/i?frame.*?) >/si "," ", $str); Filter Frame label $str =preg_replace ("/< (\/?i?frame.*?) >/si "," ", $str); Filter Frame label $str =preg_replace ("/< (script.*?) > (. *?) < (\/script.*?) >/si "," ", $str); Filter the script tag $str =preg_replace ("/< (\/?script.*?) >/si "," ", $str); Filter the script tag $str =preg_replace ("/javascript/si", "JavaScript", $STR); Filter the script tag $str =preg_replace ("/vbscript/si", "VBScript", $STR); Filter the script tag $str =preg_replace ("/on ([a-z]+) \s*=/si "," on\\1= ", $str); Filter the script tag $str =preg_replace ("/&#/si", "the", $str); Filter script tags, such as Javascript:alert (
PHP Common regular Replacement HTML