- preg_match_all: documentation ( source)
<?php
$re = '/^http:\/\/(.+).local.master.1ff.space\/$/m';
$str = 'http://usa.yorketo.diet.local.master.1ff.space';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
echo $matches[0][1] ?? 'NotFound';