例如:
<img src="http://topic.csdn.net/ui/images/logo_csdn.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true;......>
正则后变成
<img src="http://topic.csdn.net/ui/images/logo_csdn.gif" border="0">
就是把border=后面的部分全去掉,然后加上"0">

解决方案 »

  1.   

    string str = @"<img src=""http://topic.csdn.net/ui/images/logo_csdn.gif"" border=""0"" onload=""if(this.width>screen.width*0.7) {this.resized=true;......"">";
    System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@" onload *= *[\s\S]*>", System.Text.RegularExpressions.RegexOptions.IgnoreCase); 
    string ret = regex.Replace(str, @">");
      

  2.   

    string newValue = Regex.Match(Htmlstring, "<img[^>]*?border=", RegexOptions.IgnoreCase).Value + "0>";
                Htmlstring = Regex.Replace(Htmlstring, "<img[^>].*>", newValue, RegexOptions.IgnoreCase);
      

  3.   

    这个不对哦,你把后面的全替换掉了 我要替换到 > 这里就行了(你这里把img后面的全部替换成空了)