【发布时间】:2015-06-03 14:20:02
【问题描述】:
我正在尝试使用正在工作的 Regex.Replace 突出显示文本字符串中的文本,但是当我搜索“问题”一词时,我希望“问题”也突出显示而不是“s”。它现在突出显示,但将“问题”替换为“问题”。我怎么知道当前比赛的结尾是否有“s”? 这就是我正在使用的
e.Row.Cells[6].Text = Regex.Replace(
e.Row.Cells[6].Text,
"\\b" + Session["filterWord"].ToString() + "[s]{0,1}\\b",
"<b><font color=\"red\">" + Session["filterWord"].ToString() + "</font></b>",
RegexOptions.IgnoreCase);
【问题讨论】: