Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-04-2008, 10:46 AM   PM User | #1
navinprakash
New to the CF scene

 
Join Date: Sep 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
navinprakash is an unknown quantity at this point
regular expression validation for url

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

Regards,
Navin[/color]
navinprakash is offline   Reply With Quote
Old 09-04-2008, 11:53 AM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,033
Thanks: 197
Thanked 2,410 Times in 2,388 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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.

Last edited by Philip M; 09-04-2008 at 12:20 PM..
Philip M is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:27 AM.


Advertisement
Log in to turn off these ads.