// 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; using System.Text.RegularExpressions; public class HtmlManip { public static void Main(string[] args) { Test("http://www.aaa.dk/a.html\n" + "bla bla http://www.bbb.dk/b.html bla bla\n" + "http://www.ccc.dk/c.html bla bla http://www.ddd.dk/d.html\n"); } private static void Test(string s) { Console.WriteLine(s); Console.WriteLine(LinkCreate(s)); } public static string LinkCreate(string s) { Match m = Regex.Match(s,"(.*?)(http://[\\S]+)(.*)", RegexOptions.Singleline); if(m != Match.Empty) { return m.Groups[1] + "" + m.Groups[2] + "" + LinkCreate(m.Groups[3].ToString()); } else { return s; } } }