What I ended up doing is allowing highlighting to be turned on and off.  
The client seems to like it so far but if they complain in the future, 
I'll implement the regex.  I did a simple search like that but it 
requires more code because you have to keep track of what character 
surrounds the word (space, comma, period, dash, etc).  With regex, using 
() you just replace \1 and it works perfectly.

Andy Matthews wrote:
> You could do it really simple and search for the word followed by a space,
> comma, period or dash.
>
> <!----------------//------
> andy matthews
> web developer
> certified advanced coldfusion programmer
> ICGLink, Inc.
> [EMAIL PROTECTED]
> 615.370.1530 x737
> --------------//--------->
>
> -----Original Message-----
> From: Jake Churchill [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 23, 2006 5:45 PM
> To: CF-Talk
> Subject: REGEX help
>
>
> I'm not really good with regexes so I need some help here.  I have a
> simple search page which searches a table containing a keyword and
> description.  I want to implement highlighting which was simple.
> However, I need to enhance it slightly.
>
> For example, if the user searches for "architect" results are also
> returned for "architectural" and "architecture".  This doesn't need to
> change.  However, I do a simple ReplaceNoCase() to highlight the
> string.  So, only "architect" is highlighted when the whole word is
> actually "architectural" or "architecture."
>
> What I need is some kind of UDF or REGEX which will allow me to only
> highlight "architect" if that is the entire word but if "architect" is
> really part of a larger word it would not get highlighted.
>
> I found a highlight UDF on cflib.org but am not especially good with
> regexes so I'm not sure what sequence to be looking for.  Also, I would
> like to search for more than just a space before and after the word.  So
> if the word is hyphenated (i.e. "architectural-style" it would still
> highlight "architecture".
>
> Jake
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

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