That starts with http://
Using regular expression
Can I see a code
Thanks
Printable View
That starts with http://
Using regular expression
Can I see a code
Thanks
The easy way is to attempt to navigate to that place - if success then url is valid.
You may parse it but there could still be margin for error...
How about something simple likeCode:If Left(Text1.Text, 7) <> "http://" Then
MsgBox "Invalid URL"
End If
Why user regex when its simple to use string functions like hack posted?
What are the reqquirements for the urls? "https://", "ftp://", "ftps://" etc?
So, what happens if all you have is this:
"http://www"
It does have "http" in it but it still ain't valid... As I said best way to validate url is to try to navigate there.
Well because I have 10000 URL to check and I want to do it quickly. Surfing them one by one is not a good idea.
Doesn't have to be regex but regex seems to be the way to go.
Let's see we can make sure it has only one http:// or https://
Then we look at the content between http:// and the next /
Then we look that those between and after that consists of numbers and letters allowed in a URL
There has to be regex for this one already.
Check left side as already mentioned. Check if there are unescaped characters, e.g. spaces instead of %20. URL may then be syntactically valid... but real validity can only be tested by navigation.
Well what is it that you want to accomplish? Check for valid syntax only or check for valid syntax and know the url points to a valid site?
Only valid syntax.
Of course the only way to know that the URL is valid is by actually visiting the URL.
No. Just valid syntax.