Clearing HTML Tags from a String Variable

How to remove HTML TAG-LIKE content from your strings…

Suppose you have content submitted from your client to the server, and you want to brute force scrub it out…  It’s simple with the following code:

  • ColdFusion In CFSCRIPT
    variables.TaglessString = REReplace(trim(variables.TaggedString),']*>','','all')
  • PHP – http://php.net/manual/en/function.strip-tags.php
    string strip_tags ( string $str [, string $allowable_tags ] )
  • Javascript / AKA JQUERY
    $('#theText').text()

Send me more web languages languages, and I’ll surely post it here.

Leave a Reply

Your email address will not be published. Required fields are marked *