My Projects
Search Blog

Categories
Archives
Photo Albums
RSS

Powered by
BlogCFM v1.15

28 November 2006
Using coldfusion to strip some or all HTML tags from a string

Years ago (ie, 1999), I wrote a custom tag called CF_TAGSTRIPPER that would strip HTML tags from a source string, optionally preserving specific tags.

A few years ago, I converted it to a UDF and I've used it in a variety of my applications to strip out all but a few tags - like if I wanted to allow users to use bold and italic tags.

Recently, I've had a desire to strip out only certain tags, so I modified my tagStripper function to perform this task as well.  Here's the code.  Please let me know if you see anything wrong with it!

click the link to continue reading....

Posted by rickroot at 3:45 PM | Link | 12 comments