P粉2370294572023-08-08 09:33:12
You don't need to use a slash, and you have an extra dot in the pattern. Just use this:
$string = 'https://test.com/uploads/2023/02/06/1/18413/themes/2725/images/dvd_jacket_pdf/dvd_jacket_20630.pdf';
if(preg_match('#themes/(\d+)#', $string, $check))
echo $check[1];