This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to validate the website URL through JavaScript  RSS feed

 
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
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!