// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Text.RegularExpressions; class MainClass { public static void Main(string[] args) { string inputString = "bla bla a href=\"www.test.com\" bla bla href=\"http://www.test2.com\" bla bla"; Regex r = new Regex("href\\s*=\\s*(?:\"(?<1>http://[^\"]*)\")",RegexOptions.IgnoreCase|RegexOptions.Compiled); for (Match m = r.Match(inputString); m.Success; m = m.NextMatch()) { Console.WriteLine("htmllink found:" + m.Groups[1]); } } }