preg_match()
// 書式
preg_match (
string $pattern ,
string $subject ,
array &$matches = null ,
int $flags = 0 ,
int $offset = 0
) : int|false
// 戻り値
0 : 一致しなかった
1 : 一致した
false : エラー
// 例
$str = 'items_123';
if( preg_match('/^items(_?(.*?))\.json$/', $str, $m) ){
echo $m[0]; // "items_123"
echo $m[1]; // "_123"
echo $m[2]; // "123"
}