Regexp can do it for you:

<cfscript>
newurl = "new url to prepend/";
regexp = "(<a\s[^>]*href="")(.*?)(""[^>]*>)";
newtext = REReplaceNoCase(text,regexp,"\1#newurl#\2\3","all");
</cfscript>

This only takes links into consideration and the url has to be
surrounded by double quotes. If the href attribute can have double,
single or no quotes around the value, it needs a bit more work (a loop).
You can get inspiration from my post in the thread "regexp help ..."
from this morning
(http://www.houseoffusion.com/lists.cfm/link=i:4:199744).

Pascal

> -----Original Message-----
> From: Dave Phillips [mailto:[EMAIL PROTECTED]
> Sent: 23 March 2005 08:37
> To: CF-Talk
> Subject: RE: Extracting/Replacing URL's from text
> 
> Actually, this is a bit too simplified because what I needed was a way
to
> search for url's in a body of text without knowing what they are.
Here's
> what I came up with...a little custom tag called CF_GetLinkList.
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:199745
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to