title: What is a good regular expression to match a URL?
body: <p>Currently I have an input box which will detect the URL and parse the data.</p>
  
  <p>So right now, I am using:</p>
  
  <pre><code>var urlR = /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)
             (?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/;
  var url= content.match(urlR);
  </code></pre>
  
  <p>The problem is, when I enter a URL like <code>www.google.com</code>, its not working. when I entered <code>http://www.google.com</code>, it is working.</p>
  
  <p>I am not very fluent in regular expressions. Can anyone help me?</p>