Highlighted

help removing encoded html from string

Explorer ,
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?

Adobe Community Professional
Correct answer by BKBK | Adobe Community Professional

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>

TOPICS
Getting started

Views

311

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

help removing encoded html from string

Explorer ,
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?

Adobe Community Professional
Correct answer by BKBK | Adobe Community Professional

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>

TOPICS
Getting started

Views

312

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

Copy link to clipboard

Copied

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
Reply
Loading...
Apr 04, 2015 0