public static String GetValidBlobName(this String name, bool strict = false)
{
var cleanupAttempt = CompiledExpressions.RepeatingSlashDotReplaceRegex.Replace(
CompiledExpressions.RepeatingDotSlashReplaceRegex.Replace(name,
"."),
"/");
if (cleanupAttempt.EndsWith(".") || cleanupAttempt.EndsWith("/"))
cleanupAttempt = cleanupAttempt.Substring(0, cleanupAttempt.Length - 1);
if (strict && !CompiledExpressions.AzureBlobNameValidationRegex.IsMatch(cleanupAttempt))
throw new ArgumentException("Cannot verify a valid blob name for the supplied string.");
return cleanupAttempt;
}