This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to validate the website URL through JavaScript

 
sandeep kethe
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI
I am fairly new to Java Script. Can anyone help me how to validate the website URL using Javascript.I am uSing this regural expression however its not working.
Here is the expression /^(http:\/\/www.|www.){1}([\w]+)(.[\w]+){1,2}$/;

Regards
K.Sandeep
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That reg expression looks like it will fail many cases, take a look at the one here:
http://snippets.dzone.com/posts/show/452

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic