No, sadly. It's just a field of text, sometimes the entries (names) are
seperated by commas, sometimes by new lines, but not everything is a name.

A bit of background - basically, this is a text description about an event,
and includes the names of the artists performing. I'm trying to implement a
function so that the client can add profiles about artists, and if the
artist has a profile this is reached by a link to a new window containing
more info, an image etc..

For example typical content in the works_string might look like:

David Rees-Williams Trio<br>

<b>A Taste of France: Jazz Transcriptions of the Classics.</b>

But the only part that might need to be transformed to a link would be David
Rees-Williams Trio. That's fine, and the code I wrote can do that. However,
you might also have a profile for David Rees-Williams, so the code needs to
be clever enough to recognise that, and this is where the problem lies.

If I was building this from scratch I'd change the way the data is stored,
so that each artist was a separate entry in the db, and then it would be an
easy task. But I'm not and that's not really an option.

Thanks

Will

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

Is there a delimited in the list of names (work_string), something that you
can include in your reg ex to "anchor" it to an entire entry? 
        Mark

-----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
 






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:276385
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to