Filter HTML tags out of a string.

A little RegEx Filter out any HTML tags passed in a string.

<cfset MyString = REReplace(MyString, "<[^>]*>", "", "All")>

Example:

<!--- Fill MyString with an example string --->
<cfset MyString="Hello <br><font><cfoutput><head>world">
<cfset MyString = REReplace(MyString, "<[^>]*>", "", "All")>
<cfoutput>#MyString#</cfoutput>

The output would be:

Hello world

 

Share this article!

Follow us!

Find more helpful articles: