'/{([a-zA-Z0-9-_]+)}/', default => null, }; } public static function matchRouteString(string $value): PathSegmentTypeMatch { $type = PathSegmentType::Parameter; $regex = $type->routeMatchRegex(); if (preg_match($regex, $value, $matches) === 1) { $value = $matches[1]; } else { $type = PathSegmentType::Raw; } return new PathSegmentTypeMatch($type, $value); } }