File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to validate the website URL through JavaScript

 
sandeep kethe
Greenhorn
Posts: 14
  • 0
  • 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
  • 0
  • 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