<a href='http://www.77ya.com/' target='_blank'><img src='adf.jpg'/>/</a>阿赛、郭言赛<a href='http://www.beauty021.com' target='_blank'>http://www.beauty021.com</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.   

                string str = @"<a href='http://www.77ya.com/' target='_blank'><img src='adf.jpg'/>/</a>阿赛、郭言赛<a href='http://www.beauty021.com' target='_blank'>http://www.beauty021.com</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>阿赛、郭言赛";
                Regex reg = new Regex(@"(?i)<a[^>]*>(?:(?!www\.beauty021\.com)[^><])*<\/a>");
                MatchCollection mc = reg.Matches(str);
                foreach (Match m in mc)
                {
                    Console.WriteLine(m.Value);
                }
      

  2.   

    string str = @"<a href='http://www.77ya.com/' target='_blank'><img src='adf.jpg'/>/</a>阿赛、郭言赛<a href='http://www.beauty021.com' target='_blank'>http://www.beauty021.com</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>阿赛、郭言赛";
                Regex reg = new Regex(@"(?i)<a[^>]*>(?:(?!www\.beauty021\.com)[^><])*<\/a>");
                MatchCollection mc = reg.Matches(str);
                foreach (Match m in mc)
                {
                    Response.Write(m.Value);
                }楼上的可以啊。通过