Highlighting of Keywords

Results 1 to 3 of 3

Thread: Highlighting of Keywords

  1. #1
    Join Date
    Dec 1969

    Default Highlighting of Keywords

    I feel a little asking but I can&#039;t find the code that I would constantly stumble upon for when a user searchs that will highlight the keywords in the results when they drew?<BR><BR>I guess you could do an instring function on the keyword and wrap bold tags or whatever around it but I&#039;d like to see how others have done this before reinventing the wheel. <BR><BR>Thanks in advance.

  2. #2
    Join Date
    Dec 1969

    Default RE: Highlighting of Keywords

    Text = replace(text, searchstring, "&#060;i&#062;searchsting&#060;/i&#062;")

  3. #3
    Join Date
    Dec 1969

    Default Slightly better than that...

    ...is to use a regular expression, so that you preserve the case of the thing you are highlighting.<BR><BR>Set re = New RegExp<BR>re.Pattern = "(searchstring)"<BR>re.IgnoreCase = True<BR>re.Global = True<BR>text = re.Replace( text, "&#060;B&#062;$1&#060;/B&#062;" )<BR><BR>Untested, but it&#039;s something like that.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts