110,533
社区成员
发帖
与我相关
我的任务
分享
public static void TestRegex19()
{
string test = @"<img src=""/images/logo.gif"" /> 不匹配它
<img src=""/2010-07-23/eacf3121417856bcb4ac5508e0e1ca30.jpg"" > 匹配它";
MatchCollection mc = Regex.Matches(test, @"<img(?![^>]+/>)[^>]*>");
foreach (Match m in mc)
{
Console.WriteLine(m.Value);
}
}
(?i)<img[^>]*(?<!/\s*)>