Validate GUID

Blessyjees
Posted by Blessyjees under Regular Expressions category on | Points: 40 | Views : 3838
Using regular expression we can check the Guid is valid or not

Regular Expression: ^[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}$
C# Code
Regex isGuid = new Regex(RegExFormats.GuIDPattern, RegexOptions.IgnoreCase);
bool match= isGuid.IsMatch(retValue)


If the given Guid (retValue) is match it will return true, otherwise false.

Comments or Responses

Login to post response