Mega Code Archive

 
Categories / C# / Development Class
 

Is valid GUID

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; public static class UtilityExtension {     public static readonly Regex guidRegEx = new Regex(@"^(\{{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}\}{0,1})$");     public static bool IsGuid(this string expression)     {         if (!String.IsNullOrEmpty(expression))         {             return guidRegEx.IsMatch(expression);         }         return false;     } }