7,765
社区成员
发帖
与我相关
我的任务
分享
string test = "<img src=\"test.jpg\"><img style=\"width: 488px; height: 228px\" height=\"215\" src=\"http://static13.photo.sina.com.cn/bmiddle/4c0122eeg651d4364223c\" width=\"460\" align=\"right\" /> ";
Regex reg = new Regex(@"(?is)<img\s(?:(?!src=)[^>])*src=""(?:(?!photo\.sina)[^>])*photo\.sina[^""]*""[^>]*>");
string result = reg.Replace(test, "");
richTextBox2.Text = result;
<img src="test.jpg"><img style="width: 488px; height: 228px" height="215" src="http://static13.photo.sina.com.cn/bmiddle/4c0122eeg651d4364223c" width="460" align="right" />
你会捕获整个这段的string result = Regex.Replace(html,@"(?is)<img[^<>]*src=""[^<>""]*?photo.sina[^>]*>","");