日期:2014-05-17 浏览次数:20746 次
<a href="1.html"><img src ..></a> <a href="1.html">文字</a><a href="2.html"><img src ..></a> <a href="2.html">文字</a> <a href="3.html"><img src ..></a> <a href="3.html">文字</a>
<a href="1.html">文字</a><a href="2.html"><img src ..></a>
(?is)<a[^>]*><img(?><a[^>]*>(?<Open>)|</a>(?<-Open>)|(?:(?!</?a\b).)*)*(?(Open)(?!))</a> 试试
------解决方案--------------------
Regex reg = new Regex(@"(?is)(?<=<img)[^>]*?(?=>)");
------解决方案--------------------
(?i)<a\b[^>]*?><img\b[^>]*?></a>
------解决方案--------------------
Regex re = new Regex(@"<a[^>]*><img[^>]*></a>", RegexOptions.Singleline); MatchCollection mc = re.Matches("text"); foreach (Match ma in mc) { }