/// <summary> /// 获取网页内容的图片地址 /// </summary> /// <param name="html">要传入的html文档</param> /// <returns></returns> private void PickupImgUrl(string html) { Regex regImg = new Regex(@"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>", RegexOptions.IgnoreCase); MatchCollection matches = regImg.Matches(html); if (ImagePath == null) { ImagePath = new List <string>(); } foreach (Match match in matches) { ImagePath.Add(match.Groups["imgUrl"].Value); } }