i try to get product id from this url, the pattern is try to find number after p- and before .html
http://www.domain.com/jp-37025-shoes-red-p-362060.html?stores=203
http://www.domain.com/pp-66743-shoes-red-p-665322.html?stores=12
result should be:
362060
665322
my current code:
$subject = "http://www.domain.com/jp-37025-shoes-red-p-362060.html?stores=203";
$patern = '/\W*[a-z]\D*/';
$string = preg_replace($patern, '', $subject);
echo $string;