CFLib.org – Common Function Library Project

StripAnchors(str)

Last updated November 1, 2002
Download UDF

author

Brian Brown                                       Brian Brown

Version: 2 | Requires: ColdFusion 5 | Library: StrLib

 
Rated 0 time(s). Average Rating: 0

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:

<cfscript>
/**
* 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");
}
</cfscript>

Search CFLib.org


Latest Additions

Shawn Porter Shawn Porter added
DeMoronize
3 hour(s) ago

Chris Carey Chris Carey added
readPropertiesFi...
1 day(s) ago

Randy Johnson Randy Johnson added
lastDayofWeek
3 day(s) ago

Frank Marion Frank Marion added
sitemapPing
7 day(s) ago

Top Rated

James Sleeman                                     QuickSort
Rated 5.0, 3 time(s)

Barney Boisvert indentXml
Rated 5.0, 3 time(s)

Nathan Dintenfass                                 queryColumnsToSt...
Rated 5.0, 3 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 3 time(s)

Created by Raymond Camden / Design by Justin Johnson