title: Find URLs in String, JQUERY
body: <p>I have some function to grab all the urls found in a string, which works great and as it should. However, it's not grabbing the full URL with segments, if they exist (i.e. <a href="http://domain.com/somepage/stuff" rel="nofollow">http://domain.com/somepage/stuff</a>, <a href="http://goo.gl/ew34r" rel="nofollow">http://goo.gl/ew34r</a>, <a href="http://bit.ly/w9r34" rel="nofollow">http://bit.ly/w9r34</a>, etc.). It'll just pull the base domain, not any trailing URL segments.</p>
  
  <p>How can I modify my regex to include all url segments if they exists?</p>
  
  <p><code>var urls = text.match(/\b(http|https)?(:\/\/)?(\S*)\.(\w{2,4})\b/ig);</code></p>
  
  <p>The above needs to extract all URL variations, such as:</p>
  
  <pre><code>www.domain.com
  domain.com
  http://www.domain.com
  http://www.domain.com/somepage
  http://www.domain.com/somepage/morepage
  http://www.domain.com/somepage/morepage/*
  www.domain.com/somepage
  www.domain.com/somepage/morepage
  www.domain.com/somepage/morepage/*
  domain.com/somepage
  domain.com/somepage/morepage
  domain.com/somepage/morepage/*
  </code></pre>
  
  <p>URIs can include numbers obviously.</p>