title: How do I make a regex match a query string?
body: <p>I'm working on a simple router, and I need to be able to identify if there's a query-like structure at the end of a URL address.
  What I came up with:</p>
  
  <pre><code>(\?([^&amp;=]+)=([^&amp;=]+)&amp;?)+$
  </code></pre>
  
  <p>simply does not work! It works on a first iteration: i.e. <code>xxx?foo=bar</code>, but definitely not on two i.e. <code>xxx?foo=bar&amp;greeting=hello</code> won't work.</p>
  
  <p>What am I doing wrong? And also: Is there a better solution to accomplish this?</p>