Author: opaz | Posted on: 9/21/2009 12:04:57 AM | Views : 483

Hi,
I have the following method for highlighting a keyword in a text that works perfect. But I want to highlight the complete word where the keyword is in.
E.g.
Text: "This is a test sentence"
Keyword: "tence"
Then it will be like this: "sen<b>tence</b>"
but I want to have the whole word highlighted like this: "<b>sentence</b>"
How can I do that?


        private static string HighlightKeywords(string keywords, string text)
        {
            // Swap out the ,<space> for pipes and add the braces
            Regex r = new Regex(@", ?");
            keywords = "(" + r.Replace(keywords ...

Go to the complete details ...