parseURL($req->url)); if(preg_match("<^/(items|folders|feeds|cleanup|version|status|user)(?:/([^/]+))?(?:/([^/]+))?(?:/([^/]+))?/?$>", $path, $matches)) { $scope = $matches[1]; var_export($scope); } else { return new Response(404); } } }