4

I use this

string matchString = Regex.Match(sometext, "<img.+?src=[\"'](.+?)[\"'].+?>", RegexOptions.IgnoreCase).Groups[1].Value;

to get an images src.

But how do I can get all src what I can find?

Thanks!

NoWar
  • 36,338
  • 80
  • 323
  • 498

1 Answers1

12

You should use Regex.Matches instead of Match, and you should add the Multiline option I believe:

foreach (Match m in Regex.Matches(sometext, "<img.+?src=[\"'](.+?)[\"'].+?>", RegexOptions.IgnoreCase | RegexOptions.Multiline))
{
    string src = m.Groups[1].Value;
    // add src to some array
}
urraka
  • 997
  • 7
  • 9