Home
Manage Your Code
Snippet: IsGuid() (C#)
Title: IsGuid() Language: C#
Description: IsGuid() Views: 379
Author: paul edwards Date Added: 6/25/2012
Copy Code  
1public static bool IsGUID(string expression)
2{
3    if (expression != null)
4    {
5        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})$");
6        return guidRegEx.IsMatch(expression);
7    }
8    return false;
9}