/// <summary>
/// 取出HTML中的图片地址
/// </summary>
/// <param name="HTMLStr">HTMLStr</param>
public static string GetImgUrl(string HTMLStr)
{
string str = string.Empty;
Regex r = new Regex(@"<img\s+[^>]*\s*src\s*=\s*([']?)(?<url>\S+)'?[^>]*>",
RegexOptions.Compiled);
Match m = r.Match(HTMLStr.ToLower());
if (m.Success)
str = m.Result("${url}");
return str;
}
/// 取出HTML中的图片地址
/// </summary>
/// <param name="HTMLStr">HTMLStr</param>
public static string GetImgUrl(string HTMLStr)
{
string str = string.Empty;
Regex r = new Regex(@"<img\s+[^>]*\s*src\s*=\s*([']?)(?<url>\S+)'?[^>]*>",
RegexOptions.Compiled);
Match m = r.Match(HTMLStr.ToLower());
if (m.Success)
str = m.Result("${url}");
return str;
}