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>
<cfset myFile = ReReplaceNoCase(myFile, "(<a.*?>)(.*?)(</a>)", "\2", "all")>
<cfoutput>Replaced content: #myFile#</cfoutput>
TweetBacks
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
[Add Comment]
[Subscribe to Comments]
I want to get a hyperlink's existance is a webpage. Say in a webpage a.html there is a hyperlink &l;a href="http://phpdevelopers.rankingoogle.com" title="php developer" class=x>PHP Developer</a> ; a general type of hyperlink pattern. From all types of hyperlinks in the page our links existance will be checked following the <a href=... pattern.. How to do it ??
# Posted By PHP developer
| 31/01/08 18:17
[Add Comment]
