/ Published in: PHP
URL: http://tim.mackey.ie/CommentView,guid,2ece42de-a334-4fd0-8f94-53c6602d5718.aspx
The PHP Code appears in Post Comments
Expand |
Embed | Plain Text
function cleanHTML($html) { /// <summary> /// Removes all FONT and SPAN tags, and all Class and Style attributes. /// Designed to get rid of non-standard Microsoft Word HTML tags. /// </summary> // start by completely removing all unwanted tags // then run another pass over the html (twice), removing unwanted attributes $html = ereg_replace("<([^>]*)(class|lang|style|size|face)=(\"[^\"]*\"|'[^']*'|[^>]+)([^>]*)>","<\\1>",$html); $html = ereg_replace("<([^>]*)(class|lang|style|size|face)=(\"[^\"]*\"|'[^']*'|[^>]+)([^>]*)>","<\\1>",$html); return $html }
Comments
Subscribe to comments
You need to login to post a comment.

can u give me code for extracting the destination attribute from the tag. i.e
My Contributions from this tag i need only http://www.dreamincode.net/?p=kudos&kudosmember=292011. please give me regular expression code in php