RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^((?-i:0x)?[A-Fa-f0-9]{32}| [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}| \{[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}\})$
Description
Validates a GUID/UUID, without capture, to the following patterns: [{hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh}], [hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh],[hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh],[0xhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh], where 'h' is a valid hex character. This last pattern is a binary format commonly used with SQL Server 2000. It allows you to use binary(n) and varbinary(n) parameters that convert well to unique identifier. Please note that this is not case sensitive EXCEPT the 'x' in the binary pattern. It must be lower case.
Matches
6F9619FF-8B86-D011-B42D-00C04FC964FF | 0x6F9619FF8B86D011B42D00C04FC964FF | {6F9619FF-8B86-D011-B42D
Non-Matches
{6F9619FF8B86D011B42D00C04FC964FF} | 0X6F9619FF8B86D011B42D00C04FC964FF
Author Rating: The rating for this expression. Patrick Fogarty
Source home-grown
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Improvment
Name: zfan
Date: 9/12/2012 9:08:59 PM
Comment:
^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$ it's more simple but it only works for UUID.


Title: Improve the efficiency.
Name: g1smd
Date: 8/4/2012 6:48:08 PM
Comment:
The [A-Fa-f0-9] character group simplifies to [0-9a-f] if you add the "case insensitive" flag - and will then parse 33% faster.


Title: Made it work with some adjustments
Name: Anthony Tambrin
Date: 8/26/2009 8:28:37 PM
Comment:
(?-i:0x)?[A-Fa-f0-9]{32}|[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}|{[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}\}


Title: Doesn't work
Name: John Shepard
Date: 10/24/2005 8:38:03 AM
Comment:
Doesn't seem to work correctly.


Copyright © 2001-2014, RegexAdvice.com | ASP.NET Tutorials