Regex to validate domain name / URL in jQuery

function is_valid_url(url) {
    return /^((http|https):\/\/)?([a-zA-Z0-9_][-_a-zA-Z0-9]{0,62}\.)+([a-zA-Z0-9]{1,10})$/.test(url);
  }

Enjoy :)