- preg_match: documentation ( source)
<?php
$tzs = array(
'Europe/London',
'America/New_York',
'America/Costa_Rica',
);
foreach ( $tzs as $tz ) {
preg_match('/([[:alpha:]\/]{3,30})(?!.*([[:alpha:]\/]{3,30}))/', $tz, $match);
echo $tz . ' => ' . $match[0] . PHP_EOL;
}