用正则表达式如何替换非<br>的其它HTML标记? 如题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //先把<br>替换成不会出现的字符//在把<*>替换为空//把<br>替换回来//只能说先解决问题,但不是最好的方法,就当顶了 string S = @"1<br>2<b>3</b>4<br>5"; S = Regex.Replace(S, "<br>", "\0x07\0x08", RegexOptions.IgnoreCase); S = Regex.Replace(S, @"<[^>]*>", "", RegexOptions.IgnoreCase); S = Regex.Replace(S, "\0x07\0x08", "<br>", RegexOptions.IgnoreCase); string yourStr = ..............;string resultStr = Regex.Replace(yourStr, @"<(?!br>)[^>]*?>", "" , RegexOptions.IgnoreCase); string body = Regex.Replace(lst[i].HTMLBody, @"<br.*?>", "\n", RegexOptions.IgnoreCase); body = Regex.Replace(body, @"<[\s\S]*?>", "", RegexOptions.IgnoreCase); Access数据库的连接 SQL2000 连接出现问题,重新启动电脑有好了??? 窗体传值问题(listView1) 如何在动态表格单元格里的超连接 C#加密问题 关于treeview中tag的问题,急!! .net问题 如何在自定义的配置内使用Server对像 如果我的程序最小化为一个notifyicon。。。我想用shift+z+x使其最大化。如何实现? C#作的程序能在win98上运行吗? vs2005与vs.net2005是同一套软件吗 【求教高人!,在线等】如何控制GridView中HeadText的本地化
//在把<*>替换为空
//把<br>替换回来
//只能说先解决问题,但不是最好的方法,就当顶了 string S = @"1<br>2<b>3</b>4<br>5";
S = Regex.Replace(S, "<br>", "\0x07\0x08", RegexOptions.IgnoreCase);
S = Regex.Replace(S, @"<[^>]*>", "", RegexOptions.IgnoreCase);
S = Regex.Replace(S, "\0x07\0x08", "<br>", RegexOptions.IgnoreCase);
string resultStr = Regex.Replace(yourStr, @"<(?!br>)[^>]*?>", "" , RegexOptions.IgnoreCase);
body = Regex.Replace(body, @"<[\s\S]*?>", "", RegexOptions.IgnoreCase);