wizard341 has asked for the wisdom of the Perl Monks concerning the following question:

Im currently investigating a search feature that runs through the text and highlights it for the user to see (pretty revolutionary huh? ;p). Anyways i was wondering if there was any way i could use the CGI.pm model, or if it wouldnt be too much of a headache to embed some html, in the cgi file, to highlight the text for me. I breifly glazed over the cpan description of CGI.pm and quickly found myself overwhelmed.

Does anyone have any suggestions on how i can highlight text? (word matching is no problem so dont worry about explaining it ) Thanks in advance!

Replies are listed 'Best First'.
Re: Looking to highlight my text
by derby (Abbot) on Jul 28, 2003 at 21:15 UTC
      ahh! thanks guys

      Very cool!

Re: Looking to highlight my text
by diotalevi (Canon) on Jul 28, 2003 at 21:22 UTC

    Easy - replace the text with something that sets the CSS class. Allowing user submitted regexes is somewhat dodgy without precautions - I'm making sure your user data is safe by using \Q\E on it.s((\Q$match\E))(<span class="found_text">$1</span>)sg