$d = opendir($dir);
$worlds = array();
$regions = array();
while ($f = readdir($d))
if (eregi("(world[[:digit:]]{8}).txt$", $f, $reOut) $worlds[] = $reOut[1]; else
if (eregi("(region[[:digit:]]{8}).txt$", $f, $reOut) $regions[] = $reOut[1];
closedir($d);
$worlds will be populated by filenames (without extension) that have "world" (case in-sensitive) in the beginning, followed by 8 digits. Files are all .txt, but the extension doesn't get remembered. If you want it too, replace $reOut[1] with $f. In that case, you may also remove "(" before "world" and ")" before ".txt".
Same goes for $regions.