help removing encoded html from string

Explorer ,
Mar 26, 2015 Mar 26, 2015

Copy link to clipboard

Copied

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?

TOPICS
Getting started

Views

325

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Apr 04, 2015 Apr 04, 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>

Likes

Translate

Translate
Adobe Community Professional ,
Apr 04, 2015 Apr 04, 2015

Copy link to clipboard

Copied

LATEST

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>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines