if you are using ASP.NET, trystr = str.Replace("Keyword","<span style='background-color:red'>Keyword</span>");