Haha! Beer may have played a part in that article... oh and I accept the beer. 
;-)

Cheers!

-----Original Message-----
From: Will Swain [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 27, 2007 5:01 PM
To: CF-Talk
Subject: RE: Regex help looking for a name in a string.

Thanks Bobby, I owe you a beer. And not just for this but for
http://www.acoderslife.com/news/index.cfm?storyid=7 too!!

Will

-----Original Message-----
From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] 
Sent: 27 April 2007 21:21
To: CF-Talk
Subject: RE: Regex help looking for a name in a string.

Sorry, Should have said that you DO still have to: 
order by length(artist) desc

-----Original Message-----
From: Bobby Hartsfield [mailto:[EMAIL PROTECTED]
Sent: Friday, April 27, 2007 3:43 PM
To: CF-Talk
Subject: RE: Regex help looking for a name in a string.

Or a couple loops....

<!--- loop the query and replace the names with markers ---> <cfloop
query="artists">
        <cfset thetext = replacenocase(thetext, artist, "**#currentrow#**",
"all") />
</cfloop>

<!--- now loop again and replace the placeholders with their links --->
<cfloop query="artists">
        <cfset thetext = replace(thetext, "**#currentrow#**", "<a
href='mypage.cfm?var=#artist#'>#artist#</a>", "all") /> </cfloop>

That did the trick for me.

-----Original Message-----
From: Bobby Hartsfield [mailto:[EMAIL PROTECTED]
Sent: Friday, April 27, 2007 3:34 PM
To: CF-Talk
Subject: RE: Regex help looking for a name in a string.

I don't know what I was thinking but that wont work either. Say you had
Bobby and Bobby Hartsfield

If you replaced Bobby Hartsfield with a link then Bobby... the code would
replace the Bobby within Bobby Hartsfield

You will need to order the names by length descending to make sure the
longer names are taken care of first but you will also need to use a regular
expression to replace the strings only if they are NOT within
<a.*?>(#artist#)</a> already


-----Original Message-----
From: Bobby Hartsfield [mailto:[EMAIL PROTECTED]
Sent: Friday, April 27, 2007 3:15 PM
To: CF-Talk
Subject: RE: Regex help looking for a name in a string.

Yes, Do it in your query. Try this...

Select artist
>From tablename
Order by length(artist)


-----Original Message-----
From: Will Swain [mailto:[EMAIL PROTECTED]
Sent: Friday, April 27, 2007 10:24 AM
To: CF-Talk
Subject: RE: Regex help looking for a name in a string.

Hi Bobby,

Out of interest, how would I reorder by length? In the query? MySQL 4.1.7

Thanks

Will

-----Original Message-----
From: Bobby Hartsfield [mailto:[EMAIL PROTECTED]
Sent: 27 April 2007 13:47
To: CF-Talk
Subject: RE: Regex help looking for a name in a string.

Reorder by length so the longer names come first. Also, I think you only
need replace(works_string, artist, "<a href='profiles.cfm?e=#profileID#'
target='artistWin'>#artist#</a>", "all")















~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276459
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