public List<string> GetAllImageUri(string content)
{
{
string pattern =
@"<(?<Tag_Name>img)\b[^>]*?\b(?<URL_Type>(?(1)src))\s*=\s*(?:""(?<URL>(?:\\""|[^""])*)""|'(?<URL>(?:\\'|[^'])*)')";
// Getting collection of matched uri.
MatchCollection imageUriCollection =
MatchCollection imageUriCollection =
Regex.Matches(content, pattern, RegexOptions.IgnoreCase);
if (imageUriCollection.Count > 0)
{
{
return imageUriCollection.Cast<Match>()
.Select(x => x.Groups["URL"].Value)
.ToList();
}
return null;
}
Comments
Post a Comment