I think this is a good approach too, but it will get complicated because you have to avoid matching text inside an existing already-hyperlinked bit of text. I suspect that this is less of a regex problem and the solution will require searching for strings "manually", but at least the solution can be described and wil work, so that's something.
Mark -----Original Message----- From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] Sent: Friday, April 27, 2007 8:47 AM 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") -----Original Message----- From: Will Swain [mailto:[EMAIL PROTECTED] Sent: Friday, April 27, 2007 5:27 AM To: CF-Talk Subject: Regex help looking for a name in a string. Ok, no doubt this is an easy RegEx question, but not for me. I have two queries. One returns a set of names, the other a string which may or may not contain one or more of the names. I want to check for the existence of a name in the string, and if I find it, make it a hyperlink. So far I have this: <cfset works_string = qry_getEvent.works> <cfloop query="qry_getProfiles"> <cfset works_string = REReplaceNoCase(#works_string#, #artist#, "<a href='profiles.cfm?e=#profileID#' target='artistWin'>#artist#</a>", "ALL")> </cfloop> Which works in a limited sense but stumbles where names are similar or contain the same words - for example John Smith John Smith & Sons If the string contained John Smith & Sons, the code would highlight the John Smith part but not the rest. Any suggestions? Thanks will ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276391 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4