Author: imperialx | Posted on: 8/19/2009 6:37:19 AM | Views : 263

Hi,
How do you validate a url whether it has subdomain (www) or http:// or https://?
This Regex doesn't look good,

        Dim re As New Regex("^(http|ftp)://(www\.)?.+\.(com|net|org)$")
        Dim mc As MatchCollection = re.Matches("forums.asp.net")

When a user inputs a url at the browsers address bar, say "forums.asp.net", the browser simply append "http://", making it a valid url.
Also, if the user inputs a complete url "http://forums.asp.net" then might as well live it, it's valid anyway.

I would like to have the same functionality using a Regex if it is possible.


cheers,
imperialx

...

Go to the complete details ...