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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Validate GUID
Expression
((^[{])|^)[A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{12}(?(2)[}]$|$)
Description
This regex will validate a GUID. If the GUID starts with an opening curly bracket, then it must also end in a closing curly bracket. If it does not start with one, then it must not end with one.
Matches
778ed84f-2f9c-42b5-b314-4d0e0cde8422, {778ed84f-2f9c-42b5-b314-4d0e0cde8422}
Non-Matches
{778ed84f-2f9c-42b5-b314-4d0e0cde8422, 778ed84f-2f9c-42b5-b314-4d0e0cde8422}, 234l3, 23423525w
Author Rating: Not yet rated. Charles Forsyth
Source
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: Wrong
Name: Wrong
Date: 8/14/2015 9:13:46 AM
Comment:
a-z is WRONG; a guid only contains a-f (or A-F).


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