I have a bunch of urls that share the following pattern:
http://www.ebay.com/itm/Crosman-Pumpmaster-760-Pump-177-Pellet-4-5-mm-BB-Air-Rifle-Black-760B-/251635693266?pt=LH_DefaultDomain_0&hash=item3a96a7f6d2
I want to extract item3a96a7f6d2. The http://www.ebay.com/itm/ and &hash= are fixed patterns while the string in between can change. I wrote:
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);
}
But it gives me an error saying "No match found". Any help will be greatly appreciated. Thanks.