title: regular expressions how to validate a URL
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1141848/regex-to-match-url">Regex to match URL</a>  </p>
  </blockquote>
  
  
  
  <p>I wrote a regular expression to validate only the following URL patterns</p>
  
  <ol>
  <li><a href="http://www.abc.com" rel="nofollow noreferrer">http://www.abc.com</a></li>
  <li>www.abc.com</li>
  <li>abc.com</li>
  <li>http.www.abc.com</li>
  </ol>
  
  <p>Can anyone give me a regular expression?</p>
  
  <p>There's some error in the regex I used to do it, can anyone fix it?</p>
  
  <pre><code>/^((http|http|HTTP|HTTP):\/\/+(www|WWW\.)?[A-Za-z0-9\-\.]{1,}\.[A-Za-z])|((www|WWW\.)?[A-    Za-z0-9\-\.]{1,}\.[A-Za-z])/i.test(value);
  </code></pre>