> public static class MyClass > { > static string htmlSample = @" > <!DOCTYPE html> > > <html lang=""en-GB""> > <head> > <meta charset=""utf-8""> > <title>Example of an inline image</title> > </head> > <body> > <img src=""balconyview.jpg""> > <Img Src = 'balconyview.jpg' alt='View from my balcony, showing a row of houses, trees and a castle'> > <img src='http://example.com/brokenlink/sunset.gif' alt='Beautiful Sunset' /> > > </body> > </html> > "; > > public static void Main() > { > IEnumerable<String> images = GetImages(htmlSample); > foreach (string image in images) > Console.WriteLine(image); > Console.ReadLine(); > } > > static IEnumerable<String> GetImages(string html) > { > List<string> images = new List<string>(); > string pattern = @"\<img\s+src\s*=\s*((?<quote>[""'])(?<image>.*?)\k<quote>)"; > //Console.WriteLine(pattern); > MatchCollection matches = Regex.Matches(html, pattern, RegexOptions.IgnoreCase ); > foreach (Match match in matches) > { > images.Add(match.Groups["image"].ToString()); > } > > return images; > } > } >The first link I gave Gregory has an interesting bit on the memory impact of using Regex where there are a large number of matches. The example given is probably as extreme as it could get and I would be surprised if it had any relevance to the above code. But I'm useless at Regex so would be interested in your opinion.....