I'm creating a very simple file browser, and am trying to limit the path to be
$path = (strpos($path, '/local/') !== false) ? $path : "/local/ud";
This forces at least one letter after /
preg_match("/\/local\/\w.*/", $input, $output);
Edited to add \w to make sure you cant be at
/local/ <- there is supposed to be a space after /
Maybe this is even better?
One letter or digit then anything