Regular Expression for a SharePoint Correlation ID

As someone who is horrible with regular expressions, it took me longer that it should have to figure out how to match an expression in the format of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx where x is either a number from 0-9 or a letter from a-f. I hope this saves someone some time. There is probably a slicker way of doing this for those regex pros, but this works for me! Code is in C#, you will need the reference of 'using System.Text.RegularExpressions;' in your file.

 

bool match = Regex.IsMatch(valueYouAreComparing, @"([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})",RegexOptions.IgnoreCase);