...

View Full Version : regular expression validation for url



navinprakash
09-04-2008, 10:46 AM
Hi all,

Please help in validating url like -
www.domainame.com
And it should not check for (http://) using regular expression.
I am trying but finding difficult to solve it :confused:

Regards,
Navin[/color]

Philip M
09-04-2008, 11:53 AM
if(/www\.[a-z0-9][a-z0-9\-]{0,61}[a-z0-9]\.[a-z\.{2,6}]$/gi.test(url.value)) { // return true

This permits but does not require characters (such as http://) before the www.

The only valid characters for a domain name are letters, numbers and a hyphen "-". Hyphens may be anywhere in the middle of a name, but can not be located at the end or beginning of a name. A valid domain name does not have spaces. The domain name without the extension can be up to 63 characters.



All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum