Register | Login
Thursday, August 28, 2008

Sections
  
About Us
  
Hosting Provided by Server Intellect
Partners
Downloads
  
 WWWCoder.com Resource Directory

Hyperlink Activation
9/18/2004 6:49:30 PM

Parse a string and activate any text links in the string.



Public Function ActivateWebSiteUrl(ByVal siteString As String) As String
Try
Dim buf As String = siteString
Dim patternSite As String = "\w*[\://]*\w+\.\w+\.\w+[/\w+]*[.\w+]*"
Dim re As Regex = New Regex(patternSite)
If re.IsMatch(buf) Then
buf = re.Replace(buf, AddressOf WebSiteMatchEvaluator)
End If
Return buf
Catch ex As Exception
Return siteString
End Try
End Function

Private Function WebSiteMatchEvaluator(ByVal m As Match) As String
Dim ub As UriBuilder = New UriBuilder(m.Value)
Dim sb As StringBuilder = New StringBuilder("<a href='")
sb.Append(ub.ToString())
sb.Append("'>")
sb.Append(m.Value)
sb.Append("<a>")
Return sb.ToString()
End Function


Page Options:
format for printing  Format for Printer
email article  Email Page
add to your favorites   Add to Favorites
How would you rate the quality of this content?
Poor - - Excellent
Comments?
Overall Rating:
Comments Left:
  

 Latest Articles
  

 Latest News
  

 

Spotlight
Syndication

 


 


Digg This
 


DotNetNuke Platinum Benefactor

  
 

 Terms Of Use | Privacy Statement
 Copyright 2008 - Santry Technology Solutions, Box 172, Girard, PA 16417, (814) 774-0970