title: Java regular expression to match patterns in url
body: <p>I have a bunch of urls that share the following pattern:</p>
  
  <pre><code>http://www.ebay.com/itm/Crosman-Pumpmaster-760-Pump-177-Pellet-4-5-mm-BB-Air-Rifle-Black-760B-/251635693266?pt=LH_DefaultDomain_0&amp;hash=item3a96a7f6d2
  </code></pre>
  
  <p>I want to extract <code>item3a96a7f6d2</code>. The <code>http://www.ebay.com/itm/</code> and <code>&amp;hash=</code> are fixed patterns while the string in between can change. I wrote:</p>
  
  <pre><code>                String prodPatternString = "(http://www.ebay.com/itm/)(.*?)(hash=)(.*?)";
                  Pattern prodPattern = Pattern.compile(prodPatternString);
                  Matcher prodMatcher = prodPattern.matcher(prodUrl);
                  while(prodMatcher.find()){
                      String pid = matcher.group(4);
                  }
  </code></pre>
  
  <p>But it gives me an error saying "No match found". Any help will be greatly appreciated. Thanks.</p>