Validating url confusion

hi, i m working on a field that is of url. i am unable to use regex as i am new to JS, how can i use regex in my following condition


var website = $('#website').val();
    if(website=='') {
        $("#website").after('<span class="error">Enter website.</span>');
        hasError = true;
        }
    else if(!urlReg.test(website)) {
            $("#website").after('<span class="error">Website should be in http://www.website.com format.</span>');
            hasError = true;
        }

for now. it go with any .com or if i enter .123 etc. help pls


urlReg = new RegExp(^http\\://[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(/\\S*)?$);

Checks for the leading protocol, a good looking domain (two or three letter TLD; no invalid characters in domain) and a somwhat reasonable file path.

HTH

can u help me in cooperate this in my condition. i donno how to start