Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to validate the website URL through JavaScript  RSS feed

 
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
 
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
Boost this thread!