Okay, this is going to get pretty anal, so children should avert their eyes...
In order to use the backreference Nathan is describing, you'd need to wrap the keyword in parentheses: REReplaceNoCase(stringVar, "\b(architect)\b", "<html to highlight>\1</ html to highlight>", "ALL") :-D Told you that was going to be picky, but Nathan's right. You need all that other stuff to do anything useful. I was lazier than I should have been in my initial response. Rob Wilkerson On Oct 23, 2006, at 8:21 PM, Nathan Strutz wrote: > If you're trying to highlight the word architect, using rob's > regex, you > would do something like this: > > reReplaceNoCase(stringVar, "\barchitect\b", "<html to highlight>\1</ > html to > highlight", "ALL") > > Wrap it in #'s or set it to a variable. the \1 is a back reference > to your > regex search, so in this case you could hard-code it to the word > architect. > > -nathan strutz > http://www.dopefly.com/ > > ps, firefox 2.0 spell checker is rad. > > > > On 10/23/06, Rob Wilkerson <[EMAIL PROTECTED]> wrote: >> >> Try "\barchitect\b". Of course, replace "architect" with the keyword >> that was entered. the "\b" marks word boundaries. >> >> Rob Wilkerson >> >> >> >> On Oct 23, 2006, at 6:44 PM, Jake Churchill wrote: >> >>> 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:257821 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4