C# - detect string to link

detect a URL in a string and convert it to a clickable link


protected string TwitterHyperLink(string txt)
{
    string HyperLinkPattern = @"(http://\S+)\s?";

    if (txt.Contains("http://"))
    {
        var links = new List<string>();
        foreach (Match match in Regex.Matches(txt, HyperLinkPattern))
        {
            var url = match.Groups[1].Value;
            if (!links.Contains(url))
            {
                links.Add(url);
                txt = txt.Replace(url, String.Format("<a href=\"{0}\" target='_blank'>{0}</a>", url));
            }
        }
    }

    return txt;
}