title: How to extract parameters from a given url
body: <p>In Java I have:</p>
  
  <pre><code>String params = "depCity=PAR&amp;roomType=D&amp;depCity=NYC";
  </code></pre>
  
  <p>I want to get values of <code>depCity</code> parameters (PAR,NYC).</p>
  
  <p>So I created regex:</p>
  
  <pre><code>String regex = "depCity=([^&amp;]+)";
  Pattern p = Pattern.compile(regex);
  Matcher m = p.matcher(params);
  </code></pre>
  
  <p><code>m.find()</code> is returning false. <code>m.groups()</code> is returning <code>IllegalArgumentException</code>.</p>
  
  <p>What am I doing wrong?</p>