Remove hyperlinks ( A tags ) from HTML - ColdFusion regular expression

If ever you want to remove hyperlinks from a HTML page - here you go.

This code assumes a variable has been created called myFile that has either been pulled from CFHTTP, a stored local file or from the ColdFusion page output:-

<cfset myFile = "<a href='www.mysite.com'>Click here for my site</a>">
<cfset myFile = ReReplaceNoCase(myFile, "(<a.*?>)(.*?)(</a>)", "\2", "all")>
<cfoutput>Replaced content: #myFile#</cfoutput>

Remove hyperlinks ( A tags ) from HTML - ColdFusion regular expression

If ever you want to remove hyperlinks from a HTML page - here you go.

This code assumes a variable has been created called myFile that has either been pulled from CFHTTP, a stored local file or from the ColdFusion page output:-

<cfset myFile = "<a href='www.mysite.com'>Click here for my site</a>">
<cfset myFile = ReReplaceNoCase(myFile, "(<a.*?>)(.*?)(</a>)", "\2", "all")>
<cfoutput>Replaced content: #myFile#</cfoutput>
BlogCFC was created by Raymond Camden. This blog is running version 5.9.5.002. Contact Blog Owner