Validating a GUID Value with Regular Expressions 

I am sure that most readers of this site have at one point or another noticed my RegularExpression articles.  Well this past week I was looking for a very specific regular expression and thought I would share it with you.  The following regular expresion is used to validate a GUID value for user input.  You can use this to ensure that product keys and other GUID values that you are using are in the proper format. 

^(\{){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}$

Posted by Mitchel on Sunday, April 22, 2007
 

Comments

Currently, there are no comments. Be the first to post one!
Click here to post a comment

Donate

Show your appreciation for the content/modules made available by MitchelSellers.com by making a donation. Donations are used to assist with dedicating time to creating free content.