[thelist] Help with a replace loop
Judah McAuley
judah at wiredotter.com
Mon Jun 11 19:10:18 CDT 2001
At 12:30 PM 6/11/01 -0700, sarah wrote:
><cfloop query="GetKeywords">
> <cfif FindNoCase(x,theString) is not 0>
> <cfset theString = ReplaceNoCase(theString,x,'<a
>href="#link#"><cfoutput>#x#</cfoutput></a>',"ALL")>
> </cfif>
></cfloop>
>
>This works, however, if say one of your keywords is
>"age" and theString contains "average", a link will
>get tacked onto the "age" part of average. I tried to
>think of a way around this, but nothing popped into my
>head at the moment. I'll try to see if I can find
>something, but hopefully that'll help you for now.
Instead of using FindNoCase you could use REFindNoCase to do a regular
expression search that match the keyword surrounded by spaces. I apologize
for not providing the regular expression at the moment, but I'm a bit brain
dead.
Hope this helps.
Judah
More information about the thelist
mailing list