CFLib.org – Common Function Library Project

StripAnchors(str)

Last updated November 01, 2002

author

Brian Brown

Version: 2 | Requires: CF5 | Library: StrLib

Description:
A function that will strip out all anchors in text that has been passed as an argument to the function.

Return Values:
Returns a string.

Example:

<cfsavecontent variable="foo">
This is some text with some <b>html</b> in it as
well as <a href="links.cfm">links with <b>formatting</b></a> in them.
</cfsavecontent>

<cfoutput>#stripAnchors(foo)#</cfoutput>

Parameters:

Name Description Required
str String to strip anchors from. Yes

Full UDF Source:

/**
 * A function that will strip out all anchors in text that has been passed as an argument.
 * Version 2 by Raymond Camden
 * 
 * @param str      String to strip anchors from. (Required)
 * @return Returns a string. 
 * @author Brian Brown (vonbrownz@hotmail.com) 
 * @version 2, November 1, 2002 
 */
function stripAnchors(str) {
    var temp = reReplaceNoCase(str,"<[[:space:]]*a[[:space:]]+[^>]*>","","all");
    return reReplaceNoCase(temp,"<[[:space:]]*/a[[:space:]]*>","","all");
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson