title: Regex to extract Query String
body: <p>I'm relatively new to regular expressions and could use some help. Can someone provide a regex (I'm using Perl) to extract a query string from a URL? I have tried the following but get an empty string:</p>
  
  <pre><code>my $string = 'http://www.google.com?queryArg1=1&amp;queryArg2=2';
  $string =~ s/^(.*)?//;
  </code></pre>
  
  <p>Ideally this example would provide the following string: queryArg1=1&amp;queryArg2=2</p>
  
  <p>More awesome if you could turn this into a hash:</p>
  
  <pre><code>my $hash = {queryArg1 =&gt; 1,
              queryArg2 =&gt; 2};
  </code></pre>
  
  <p>Thanks for your help!</p>