using System; using System.Text.RegularExpressions; public class Test { public static void Main() { string msg1 = "http://w...content-available-to-author-only...t.com"; string msg2 = "http://w...content-available-to-author-only...t.com"; string regex = @".+((www\.|(http|https|ftp|news|file)+\:\/\/)[_.a-z0-9-]+\.[a-z0-9\/_:@=.+?,##%&~-]*[^.|\'|\\||\# |!|\(|?|\[|,| |>|<|;|\)])(.+)?"; Regex r = new Regex(regex, RegexOptions.IgnoreCase); string f = r.Replace(msg1, "$1").Replace("href=\"www", "href=\"http://www").Replace(@"\r\n", "
").Replace(@"\n", "
").Replace(@"\r", "
"); Console.WriteLine(f); string g = r.Replace(msg2, "$1").Replace("href=\"www", "href=\"http://www").Replace(@"\r\n", "
").Replace(@"\n", "
").Replace(@"\r", "
"); Console.WriteLine(g); } }