title: Javascript regular expression for WebURL
body: <p>I want regular expression in javascript that can validate any WebURL.</p>
  
  <p>It should accept below formats:</p>
  
  <pre><code>google.com/...
  www.google.com/...
  http://google.com/...
  https://google.com/...
  </code></pre>
  
  <p>I have tried lots of regular expressions for that.But no one is looking perfect.Below are some of the tried regular expressions:-</p>
  
  <pre><code>/(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&amp;%@!\-\/]))?/
  /[a-z]+:\/\/(([a-z0-9][a-z0-9-]+\.)*[a-z][a-z]+|(0x[0-9A-F]+)|[0-9.]+)\/.*/
  /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&amp;%@!\-\/]))?/
  /^(((ht|f){1}((tp|tps):[/][/]){1}))[-a-zA-Z0-9@:%_\+.~#!?&amp;//=]+$/
  </code></pre>
  
  <blockquote>
    <blockquote>
      <p>I want regular expression should take only 3 WWW.Not more than 3 and not less than 3 WWW. </p>
    </blockquote>
  </blockquote>