title: Javascript URL validation regex
body: <p>I had the following url validation regex:</p>
  
  <p>/(ftp|https?)://[^ "]+$/</p>
  
  <p>This is from the ref: 
  <a href="https://stackoverflow.com/questions/1410311/regular-expression-for-url-validation-in-javascript/1411800#1411800">Regular expression for URL validation (in JavaScript)</a></p>
  
  <p>This works fine including cases like <code>http://localhost:8080</code>, but it also validates the below ones that i dont want. The above regex should not pass the below urls</p>
  
  <pre><code> 1. http://www.example..com
   2. http://.com
   3. http://.
   4. http://www.example. 
  </code></pre>
  
  <p>Kindly help as am a noob in regex</p>
  
  <p>Second question, though not related to the question but regex is, when i validate null and undefined against the regex <strong>/^[a-z]+$/i</strong> i get true. Is this the default behavior or am i missing something over here?</p>