title: How to parse a URL?
body: <p>If there is one thing I just cant get my head around, it's regex.</p>
  
  <p>So after a lot of searching I finally found this one that suits my needs:</p>
  
  <pre><code>function get_domain_name()
      { 
      aaaa="http://www.somesite.se/blah/sdgsdgsdgs";
      //aaaa="http://somesite.se/blah/sese";
          domain_name_parts = aaaa.match(/:\/\/(.[^/]+)/)[1].split('.');
          if(domain_name_parts.length &gt;= 3){
              domain_name_parts[0] = '';
          }
          var domain = domain_name_parts.join('.');
          if(domain.indexOf('.') == 0)
              alert("1"+ domain.substr(1));
          else
              alert("2"+ domain);
      }
  </code></pre>
  
  <p>It basically gives me back the domain name, is there anyway I can also get all the stuff after the domain name? in this case it would be <code>/blah/sdgsdgsdgs</code> from the <code>aaaa</code> variable.</p>