This will also catch www.test.com:
(((http|ftp|https):\/\/)?[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?)
↑---------------------↑↑
Just surround the part thats optional and append a questionmark.
You can check it out here.
The first match in this regex (matches are defined with "(" and ")") is the whole url. So you could use replacing like this:
Regex rgxUrls = new Regex(pattern);
string result = rgxUrls.Replace(yourText, "<a href=\"$1\"> space for custom text </a>");
↑ Inserts first match

Where I've used $1 you can also use $2 - $5. Check the image above thats showing which groups are capturing which part of the url.
Full test can be found here.
Just click execute on the top.
Output:

According the comments, how group caption works:
Text: "this is your text to search"
Pattern: "text to"
Match[0] will always match your whole match text to. Every groups above like Match[1] or Match[2] has to be defined with "(" and ")".
Text: "this is your text to search"
Pattern: "text (to)"
Match[0]: "text to"
Match[1]: "to"
Pattern: "text (t(o))"
Match[0]: "text to"
Match[1]: "to"
Match[2]: "o"
The caption with "()" works from the outside to the inside.
$1
(((http|ftp|https):\/\/)?[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?)
↑--------------------------------------------------------------------------------------------------↑
$2 (http://)
(((http|ftp|https):\/\/)?[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?)
↑---------------------↑
$3 (http)
(((http|ftp|https):\/\/)?[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?)
↑--------------↑
$4 (.com)
(((http|ftp|https):\/\/)?[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?)
↑----------↑
$5 (/appendedSubdirectory/anotherOne)
(((http|ftp|https):\/\/)?[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?)
↑--------------------------------------------------↑
I cant explain everything about regex in here. This question looks solved for me. If you've got deeper questions according regex start a new one and show some effort you've done before.