<a href='http://www.77ya.com/' target='_blank'><img src='adf.jpg'/>/</a>阿赛、郭言赛<a href='http://www.beauty021.com' target='_blank'>afddsf</a>阿赛、郭言赛<a href='http://77ya.com/' target='_blank'>http://77ya.com/</a>阿赛、郭言赛<a href='http://77ya.com' target='_blank'>http://77ya.com</a>阿赛、郭言赛<a href='http://www.77ya.com' target='_blank'>www.77ya.com</a>阿赛、郭言赛77ya.com阿赛、郭言赛<a href='mailto:[email protected]'>[email protected]</a>阿赛、郭言赛
帮忙写个正则表达式 要求不含有www.beauty021.com的<a..>..</a>拿这个修改吧<a[^>]+>(.+?)<\/a>谢谢各位了!
结果应该是这样
匹配记录1(行1:列1,长度:72):
<a href='http://www.77ya.com/' target='_blank'><img src='adf.jpg'/>/</a>
----------------------------------------------------------------------
匹配组1(行1:列48,长度:21): <img src='adf.jpg'/>/
但结果中不包含www.beauty021.com的
帮忙写个正则表达式 要求不含有www.beauty021.com的<a..>..</a>拿这个修改吧<a[^>]+>(.+?)<\/a>谢谢各位了!
结果应该是这样
匹配记录1(行1:列1,长度:72):
<a href='http://www.77ya.com/' target='_blank'><img src='adf.jpg'/>/</a>
----------------------------------------------------------------------
匹配组1(行1:列48,长度:21): <img src='adf.jpg'/>/
但结果中不包含www.beauty021.com的
Regex reg = new Regex(@"(?is)<a((?!www\.beauty021\.com)[^>])+>(.+?)</a>");
MatchCollection mc = reg.Matches(test);
foreach(Match m in mc)
{
richTextBox2.Text += m.Value + "\n";
}
/*-----输出-----
<a href='http://www.77ya.com/' target='_blank'><img src='adf.jpg'/>/</a>
<a href='http://77ya.com/' target='_blank'>http://77ya.com/</a>
<a href='http://77ya.com' target='_blank'>http://77ya.com</a>
<a href='http://www.77ya.com' target='_blank'>www.77ya.com</a>
<a href='mailto:[email protected]'>[email protected]</a>
*/
http://topic.csdn.net/u/20110407/01/a7177ec3-dec7-4244-8fc6-217aaf124b60.html过客看看这个帖子~~~