Check for valid URL using Regular Expressions
Here is the code to check whether the given string is a valid URL or not using Regular Expresssions.
Public Function IsValidUrl(ByVal Url As String) As Boolean
Dim strRegex As String = "^(https?://)" _
& "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" _
& "(([0-9]{1,3}\.){3}[0-9]{1,3}" _
& "|" _
& "([0-9a-z_!~*'()-]+\.)*" _
& "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." _
& "[a-z]{2,6})" _
& "(:[0-9]{1,4})?" _
& "((/?)|" _
& "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$"
Dim re As RegularExpressions.Regex = New RegularExpressions.Regex(strRegex)
MessageBox.Show("IP: " & Net.IPAddress.TryParse(Url, Nothing))
If re.IsMatch(Url) Then
Return True
Else
Return False
End If
End Function
Hope this helps!