Candor.WindowsAzure.Storage.Blob.CloudBlobRules.GetValidBlobContainerName C# (CSharp) Method

GetValidBlobContainerName() public static method

Gets a valid azure identifier for blob container names by trimming out invalid characters, and changing to lower case. If the name is still invalid, then an exception occurs. See remarks for naming rules.
A blob container name must start with a letter or number, and can only contain letters, numbers, and the dash (-) character. The first and last letters in the container name must be alphanumeric. The dash (-) character cannot be the first or last character. Consecutive dash characters are not permitted in the container name. All letters in a container name must be lowercase. A container name must be from 3 to 63 characters long.
public static GetValidBlobContainerName ( this name ) : String
name this
return String
        public static String GetValidBlobContainerName(this String name)
        {
            var cleanupAttempt = CompiledExpressions.NonAlphaNumericReplaceRegex.Replace(name, "")
                .ToLower();
            if (!CompiledExpressions.AzureBlobContainerNameValidationRegex.IsMatch(cleanupAttempt))
                throw new ArgumentException("Cannot Determine a valid blob container name for the supplied string.");

            return cleanupAttempt;
        }