File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes How to validate the website URL  through JavaScript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to validate the website URL  through JavaScript" Watch "How to validate the website URL  through JavaScript" New topic
Author

How to validate the website URL through JavaScript

sandeep kethe
Greenhorn

Joined: Jan 11, 2009
Posts: 14
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to validate the website URL through JavaScript