<cfset noHTMLTags = REReplaceNoCase(text, "<[\/]?[^>]*>", "", "ALL")>
ColdFusion Strip HTML tags from text
This RegEx is very basic, it will only work on valid HTML attributes. That is, if an element attribute contains the > character, it will fail. It will also fail if any of the HTML contains < or > symbols that are unencoded as < or > respectively. The check for the forward slash isn't necessary but it does help to identify what the RegEx is doing.
Snippet Viewed 9203 times.
Share your ColdFusion code snippets:
- Get some recognition & link back to your site.