Hello perl gurus.. first let me explain my predicament. i am a webmaster of a search engine running on perl. when you do a query, the search.cgi script loads a template, called search_results.html. in that template are tags that look like <%tag%>. one particular tag is troubling me, which is <%search_results%>. say that you search for "perl", and say that we get 5 results. by the default, all instances of 'perl' is bolded with tags. the format would be:

Perl Monks
Description: Website for seekers of perl wisdom.
http://www.perlmonks.com
Category: computers and internet >> programming >> perl

the bolding process is done withing search cgi, that looks like:

# This reg expression will do the trick, and doesn't bold things insid +e <> tags such as # URL's. $link_results =~ s,(<[^>]+>)|(\Q$term\E),defined($1) ? $1 : "<b>$2</b> +",gie;

one problem is when you search for the words 'description' or 'category'. the link results thing also bolds Description: and Category:, which i dont want. to paint the picture clearly:

Yahoo!
Description: Directory of websites each with a description and classified by category.
http://www.yahoo.com
Category: computers and internet >> search engines

each link result also depends on a template called searchlink.html.

it so happened that search.cgi takes it so literally that it bolds everything at its own discretion.

I wonder if there is anything i can do to have only the vital information bolded. actually i would only want the title and description matches bolded and nothing else (not even in the category or url). i believe the code i provided bolds something based on a pattern but apparently it doesn't work and i don't understand how it works, except that it looks for a certain pattern and bolds it. i wonder if i could do something similar like that. an explanation will be greatly appreciated too. thanks, looking forward to your help:-)

drewboy


In reply to Replacement based on pattern by drewboy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.