>>645
正規表現使わなくても
$parts = pathinfo($file);
$ext = ".".$parts['extension'];

$pos = strrpos($file, ".");
$ext = ".".substr($file, -$pos);