Validate URL - [Regex] | [HQ] 08-05-2013, 01:46 PM
#1
Hey,
With this snippet you can validate a URL.
I found it in my old sources, I don't own credits, I can't remember where I got this from.
Nevertheless its a professional way to validate a URL
With this snippet you can validate a URL.
PHP Code:
Private Sub ValidatewebsiteAddress(ByVal _websiteAddress As String)
If Not Regex.IsMatch(_websiteAddress, _
"^((ht|f)tp(s?)\:\/\/|~/|/)?([\w]+:\w+@)?([a-zA-Z]{1}([\w\-]+\.)+([\w]{2,5}))(:[\d]{1,5})?((/?\w+/)+|/?)(\w+\.[\w]{3,4})?((\?\w+=\w+)?(&\w+=\w+)*)?") Then
MessageBox.Show("invalid websiteAddress")
Else
MessageBox.Show("valid websiteAddress")
End If
End Sub
I found it in my old sources, I don't own credits, I can't remember where I got this from.
Nevertheless its a professional way to validate a URL
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)

![[Image: tumblr_m4vms28lYu1qj3ir1.gif]](http://media.tumblr.com/tumblr_m4vms28lYu1qj3ir1.gif)

![[Image: hObYm.gif]](http://i.imgur.com/hObYm.gif)





![[Image: CDUAq9d.png]](http://i.imgur.com/CDUAq9d.png)