The following code can be used to match all
img src
in the source text and to populate list with value of
src
attribute.
string sourceText;
var imgSrcMatches = System.Text.RegularExpressions.Regex.Matches(sourceText,
string.Format(@"<\s*img\s*src\s*=\s*{0}\s*([^{0}]+)\s*{0}","\""),
RegexOptions.CultureInvariant | RegexOptions.IgnoreCase |
RegexOptions.Multiline);
List<string> imgSrcs = new List<string>();
foreach(Match match in imgSrcMatches)
imgSrcs.Add(match.Groups[1].Value);