Class ID (CLSID) Regular Expression


I recently had the need to validate a class ID (CLSID) I was passing in a .NET function. So, I created this regular expression to perform the task.

^\{[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\}$

It will accept alpha and numeric characters in the following structure with a range of 0-9 and A-F.

Structure: {8-4-4-4-12}
Example:  {A1B2C3D4-A1B2-A1B2-A1B2-A1B2C3D4E5D6}

Each octet can be either alpha, numeric or a mix of both. I posted this to www.regexlib.com. You can see it at the following location.

http://www.regexlib.com/REDetails.aspx?regexp_id=3118

If this post helps, leave me a comment letting me know.

Advertisements

4 thoughts on “Class ID (CLSID) Regular Expression

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s