如题strTmp="<table><tr><td>111</td><td><img src='' onlcick=''></td><td><img src='' ></td></tr></table>"
string pattern =@"\<img(.*)>";
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex( pattern, RegexOptions.IgnoreCase );
strTmp= regex.Replace( strTmp, "", -1 );另外如何去掉<img中的onclick=''的属性?
string pattern =@"\<img(.*)>";
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex( pattern, RegexOptions.IgnoreCase );
strTmp= regex.Replace( strTmp, "", -1 );另外如何去掉<img中的onclick=''的属性?
string pattern =@"\<img(.*)>";
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex( pattern, RegexOptions.IgnoreCase );
strTmp= regex.Replace( strTmp, "");
Console.WriteLine(strTmp);
Console.WriteLine();
strTmp="<table><tr><td>111</td><td><img src='' onclick='' style='cc'></td><td><img src='' ></td></tr></table>";
pattern =@"(<img[^>]*)(onclick='[^']*'|onclick=""[^""]*""|onclick=[^>\s]*)([^>]*>)";
regex = new System.Text.RegularExpressions.Regex( pattern, RegexOptions.IgnoreCase );
strTmp= regex.Replace( strTmp, "$1$3");
Console.WriteLine(strTmp);