Doug,

>Was wondering how I would strip out everything between
>
><a href=this,that and the other>word</a> and just leave the word?

Rahul Narula, who works for Adobe on the web team, just posted this
recently:

http://rahulnarula.blogspot.com/2006/08/regex-treat.html

(Watch out for line wrapping in this post, you may want to snag the code for
the blog post.)

<cfscript>
text ="<!-- YOUR HTML TEXT HERE--->"; //can come from any source like file
read, cfhttp or any other
tag="a"; //the tag you want to manipulate
//You wont require to change below
tagArray=arrayNew(1);
fulltagArray=arrayNew(1);
RegEx ="<\s?#tag#\b[^>]*>(.*?)</\s?#tag#\s?>";
result =ReFindNoCase(RegEx,text,0,true);
while (result.pos[1] gt 0) {
arrayAppend(fulltagArray,mid(text,result.pos[1],result.len[1]));
arrayAppend(tagArray,mid(text,result.pos[2],result.len[2]));
result =ReFindNoCase(RegEx,text,result.pos[1]+result.len[1],true);
}
tagStripped =reReplace(text,RegEx,"\1","All");
</cfscript>
<cfdump var="#fulltagArray#" label="Full tag">
<cfdump var="#tagArray#" label="Text within the tag">
<cfoutput>
<p>Orginal text</p>
#text#
<p>Tag stripped version </p>
#tagStripped#
</cfoutput>

This code not only does what you want, but it does several other things.

-Dan


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:251246
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to