aMeeNeeMa

Clean ALL (X)HTML Tags

Apr 29th, 2012
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     <cffunction name="removeHTML" access="public" output="no" returntype="string">
  2.         <cfargument name="text" default="" type="string">
  3.         <cfset local.resstr = ReReplaceNoCase(arguments.text,"<[^>]*>","","ALL")>
  4.         <cfset local.resstr = REReplace(local.resstr, "^[^>]*>", "", "ALL")>    <!--- this is to remove invalid unclose HTML Tags --->
  5.         <cfset local.resstr = REReplace(local.resstr, "<[^>]*$", "", "ALL")>    <!--- this is to remove invalid unclose HTML Tags --->
  6.         <cfset local.resstr = ReReplaceNoCase(local.resstr,"&nbsp;{1,}"," ","ALL")>
  7.         <cfset local.resstr = ReReplaceNoCase(local.resstr," {2,}"," ","ALL")>
  8.         <cfreturn local.resstr />
  9.     </cffunction>
Advertisement
Add Comment
Please, Sign In to add comment