title: Validating url with http:www as optional using regex
body: <p>I am trying to validate a url where the "http:www" is optional, so the yahoo.com and <a href="http://www.yahoo.com" rel="nofollow">http://www.yahoo.com</a> needs to be valid url but using the following regex does not take utl3 to be valid one .
  How can I fix this ??    </p>
  
  <pre><code>function checkUrlTest(url){
              var urlregex = new RegExp("^(https?:\/\/www\.)?(^(https?:\/\/www\.)[0-9A-Za-z]+\.+[a-z]{2,5})");
  
              return urlregex.test(url);
          }
          url3 = "yahoo.com";
          url4 = "www.yahoo.com";
  
          alert(checkUrlTest(url3));
  </code></pre>