Dim regx As New Regex("http(s)?://([\w+?\.\w+])+([a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*)?", RegexOptions.IgnoreCase)
Dim mactches As MatchCollection = regx.Matches(MyString)
For Each match As Match In mactches
MyString= MyString.ToString.Replace(match.Value, "<a href='" & match.Value & "' target='_blank' >" & match.Value & "</a>")
Next
參考文章:
http://weblogs.asp.net/farazshahkhan/regex-to-find-url-within-text-and-make-them-as-link
http://www.dotblogs.com.tw/jameswu/archive/2008/04/22/3009.aspx
http://www.allenkuo.com/EBook5/view.aspx?TreeNodeID=67&id=209
http://blog.xuite.net/xiaolian/blog/59321149-%E3%80%90C%23%E3%80%91%E5%AD%97%E4%B8%B2%E6%9C%89%E6%95%88%E8%BD%89%E6%88%90%E8%B6%85%E9%80%A3%E7%B5%90
http://smallpoint-program.blogspot.tw/2012/08/phpemail.html
0 意見: