2、=''>说是道"; protectedvoidPage_Load(objectsender,EventArgse) { //stringregexstr=@"<[^>]*>"; //去除所有的标签 //@""//去除所有脚本,中间部分也删除 //stringregexstr=@"]*>"; //去除图片的正则 //stringregexstr=@"<(?!br).*?>"; //
3、去除所有标签,只剩br //stringregexstr=@"
"; //去除table里面的所有内容 stringregexstr=@"<(?!img4、br
5、p
6、/p).*?>"; //去除所有标签,只剩img,br,p str=Regex.Replace(str,regexstr,string.Empty,RegexOptions.IgnoreCase); } ASP.NET去除所有HTML标记7、javascript">functionStorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'
8、&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}注意:需要先using System.Text.RegularExpressions; /**//// /// 去除HTML标记 /// /// 包括HTML的源码
9、 /// 已经去除后的文字 public static string NoHTML(string Htmlstring) { //删除脚本 Htmlstring = Regex.Replace(Htmlstring,@"","",RegexOptions.IgnoreCase); //删除HTML Htmlstring = Regex.Replace(Htmlstring,@"
10、<(.[^>]*)>","",RegexOptions.IgnoreCase); Htmlstring = Regex.Replace(Htmlstring,@"([r])[s]+","",RegexOptions.IgnoreCase); Htmlstring = Regex.Replace(Htmlstring,@"-->","",RegexOptions.IgnoreCase); Htmlstring = Regex.Replace(Htmlstring,@"