新闻系统、blog关键字高亮效果
public static string Highlight(string Search_Str, string InputTxt)
{
Regex RegExp = new Regex(Search_Str.Replace(" ", "|").Trim(), RegexOptions.IgnoreCase);
return RegExp.Replace(InputTxt, new MatchEvaluator(ReplaceKeyWords));
}
public static string ReplaceKeyWords(Match m)
{
return "<span style=color:black;BACKGROUND-COLOR:#ffff00;>" + m.Value + "</span>";
}