Skip to main content
Inspiring
March 26, 2015
Answered

help removing encoded html from string

  • March 26, 2015
  • 1 reply
  • 529 views

Hello,

I am trying to remove all html from a user input string.

something like this:

<cfset string ="sample text &lt;a&gt;">

I have tried:

Replace(string , "<[^>]*>", "", "ALL")

Replace(string , "&lt;br &##x2f;&gt;>", "", "ALL")

Neither remove the html, can anyone help?

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer BKBK

The related functions for replacing strings using regular expressions are REReplace and REReplaceNoCase. For example,

<cfset string ="sample text <a>">

<cfoutput>#REReplace(string , "<[^>]*>", "", "ALL")#</cfoutput>

1 reply

BKBK
Community Expert
BKBKCommunity ExpertCorrect answer
Community Expert
April 4, 2015

The related functions for replacing strings using regular expressions are REReplace and REReplaceNoCase. For example,

<cfset string ="sample text <a>">

<cfoutput>#REReplace(string , "<[^>]*>", "", "ALL")#</cfoutput>