/// <summary>
/// 获取Img标签
/// </summary>
/// <param name="htmlText">截获到的html代码</param>
/// <returns></returns>
public static List<string> GetPadImg(string htmlText)
{
List<string> list = new List<string>();
Regex regImg = new Regex(@"<imgb[^<>]*?bsrc[strn]*=[strn]*[""']?[strn]*(?<imgUrl>[^strn""'<>]*)[^<>]*?/?[strn]*>", RegexOptions.IgnoreCase);
MatchCollection mc = regImg.Matches(htmlText);
foreach (Match m in mc)
{
list.Add(m.Groups["imgUrl"].Value); //获取Img标签
}
return list;
}
时间: 2025-01-01 15:00:50