Skip to content

Instantly share code, notes, and snippets.

@domgreen
Created April 16, 2011 16:21
Show Gist options
  • Save domgreen/923240 to your computer and use it in GitHub Desktop.
Save domgreen/923240 to your computer and use it in GitHub Desktop.
regex to check the naming of Azure Queues
bool match = false;
var exp = new Regex(@"^[0-9a-z]+-*[0-9a-z]+$");
if (exp.IsMatch(input))
{
if (input.Length >= 3 && input.Length <= 63)
{
match = true;
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("VALID Queue Name: {0}", input);
}
}
if (!match)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("INVALID Queue Name: {0}", input);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment