Return to Snippet

Revision: 6271
at May 14, 2008 01:26 by multani


Initial Code
function isValidURL(url){
    var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/;
    if(RegExp.test(url))
        return true;
    else
        return false;
}

Initial URL

                                

Initial Description

                                

Initial Title
URL validationin JavaScript

Initial Tags
url, javascript, validation

Initial Language
JavaScript