62,040
社区成员
发帖
与我相关
我的任务
分享
string content = "aabbcceeadc";
string key = "abc";
string result = Regex.Replace(content, "([" + key + "])", "<font color='red'>$1</font>");
string content = "aabbcceeadc";
string key = "abc";
string result = Regex.Replace(content, "(?i)[" + Regex.Escape(key) + "]+", "<font color='red'>$0</font>");
Response.Write(result);
string content = "cbdc<font color=\"red\">cba</font>aa";
string key = "abc";
string result = Regex.Replace(content, "(?in)(?<!(<|<[^/][^>]*>)[^<>]*)[" + Regex.Escape(key) + "]+(?![^<>]*(>|</))", "<font color='red'>$0</font>");
Response.Write(result);