string s_content="<p>第一张图<img height="225" alt="aa" width="300" src="/upload/UserFiles/Blue hills.jpg" />第二张图测试<img height="225" width="300" alt="bb" src="/upload/UserFiles/Winter.jpg" />得到图测试</p>
";public void pict(string input)
{ MatchCollection mc = Regex.Matches(input, @"(?<alt>(?<=<img[^>]*?alt="")[^""]+(?="")*(?<src>(?<=<img[^>]*?src="")[^""]+(?="")*)", RegexOptions.Multiline); foreach (Match m in mc)
{ Response.Write("alt: \n" + m.Groups["alt"].Value + "\n"); Response.Write("src: \n" + m.Groups["src"].Value + "\n"); }
}调用出现错误
正在分析“(?<alt>(?<=<img[^>]*?alt=")[^"]+(?=")*(?<src>(?<=<img[^>]*?src=")[^"]+(?=")*)”- ) 不足。
";public void pict(string input)
{ MatchCollection mc = Regex.Matches(input, @"(?<alt>(?<=<img[^>]*?alt="")[^""]+(?="")*(?<src>(?<=<img[^>]*?src="")[^""]+(?="")*)", RegexOptions.Multiline); foreach (Match m in mc)
{ Response.Write("alt: \n" + m.Groups["alt"].Value + "\n"); Response.Write("src: \n" + m.Groups["src"].Value + "\n"); }
}调用出现错误
正在分析“(?<alt>(?<=<img[^>]*?alt=")[^"]+(?=")*(?<src>(?<=<img[^>]*?src=")[^"]+(?=")*)”- ) 不足。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货