[thelist] Highlighting a keyword within posting retrieved

klute soundres9 at yahoo.com
Sat Apr 21 23:09:49 CDT 2007


Thanks, Hassan

Your reply is very helpful. Regex may be the way to go
but it comes with this challenge: I can't really do a
straight search and replace of the actual keyword with
SPAN since that keyword can be a part of another
(potentially unrelated) word. So, I'd have to search
and replace multiple times using a combination of
these:
- search <space><keyword>
- search <keyword><space>
- search <keyword><comma>
- search <keyword><period>
- search <forward slash><keyword>
- search <keyword><forward slash>
- etc.

That's a lot of search and replace especially for
searches containing multiple keywords but I realize
that it might be my only option.

I wish there was a regex library or something that
does what a search against a fulltext index does in
MySQL.

Best,
James
--- Hassan Schroeder <hassan.schroeder at gmail.com>
wrote:

> On 4/21/07, klute <soundres9 at yahoo.com> wrote:
> 
> > I run a job search site and am thinking of adding
> a
> > feature where whenever a user searches for a job
> by a
> > keyword, each resulting posting will have that
> keyword
> > highlighted. I have no idea how to approach this
> > "highlighting" trick. Any pointers?
> 
> java.util.regex.* is probably the bulk of it :-)
> 
> Either process in the view or post-process in a
> Filter, but either way
> you'll have to wrap the keyword in an additional
> element (SPAN or
> EM or whatever) and style that.
> 
> HTH,
> -- 
> Hassan Schroeder ------------------------
> hassan.schroeder at gmail.com
> -- 
> 
> * * Please support the community that supports you. 
> * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip
> Harvester 
> and archives of thelist go to:
> http://lists.evolt.org 
> Workers of the Web, evolt ! 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the thelist mailing list