Is valid GUID : Guid « Development Class « C# / C Sharp

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;



Related examples in the same category

1.Create Guid
2.Converts the string representation of a Guid toits Guid equivalent.
3.This code example demonstrates the Guid.NewGuid() method.
4.Parse GUID
5.Convert Guid To Guid Binary String
6.Use Regular expression to check the Guid