title: Parsing URL parameters with regular expression
body: <p>I've a url similat to example.com/?id[]=15029&amp;id[]=18711&amp;foo=bar#MyTab</p>
  
  <p>I want to get all the id's in the url</p>
  
  <pre><code>var str = window.location.search;
  var result = {};
  str.replace(/([^?=&amp;]+)(?:[&amp;#]|=([^&amp;#]*))/g, function (match, key, value) {
      result[key] = value || 1;
  });
  result;
  </code></pre>
  
  <p>Above code only returns the last id paramenter.</p>
  
  <p>How can I improve it to get all ids in an array?</p>