There's no shame in using
$num = substring($file, 4);
$num = substring($file, 0, func($file, ".htm",4))
where func is the code to find the position of the ".htm" string - don't have my phpdocs handy. But you get the idea.
ereg can be great when the formatting varies greatly. I don't know how much advantage you would get in this instance.