Sådan?
static string Test(string strInput)
{
string strPattern =
@"
(?<url>
https?:// # scheme - e.g. http
(?:[\w-]+\.)+[a-z]{2,} # host - subdomain, domain, tld
(?::\d+)? # port
(?:/~?[\w\d%:-]*(?:\.[\w\d%:-]+)*)* # path
(?:[?&][\w\d%+.-]+=[\w\d%+-]*)* # query - after the question mark ?
(?:\#[\w\d]+)? # fragment - after the hashmark #
)";
string strReplace = "<a href=\"${url}\" target=_blank>[Link]</a>";
string strResult = Regex.Replace(strInput, strPattern, strReplace, RegexOptions.IgnorePatternWhitespace);
strPattern =
@"
(?<!https?://)
(?<url>
www\. # host - subdomain
(?:[\w-]+\.)+[a-z]{2,} # host - domain, tld
(?::\d+)? # port
(?:/~?[\w\d%:-]*(?:\.[\w\d%:-]+)*)* # path
(?:[?&][\w\d%+.-]+=[\w\d%+-]*)* # query - after the question mark ?
(?:\#[\w\d]+)? # fragment - after the hashmark #
)";
strReplace = "<a href=\"
http://${url}\" target=_blank>[Link]</a>";
strResult = Regex.Replace(strResult, strPattern, strReplace, RegexOptions.IgnorePatternWhitespace);
Console.WriteLine(strResult);
return strResult;
}