C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Validating Guid


Posted Date: 23 Aug 2008    Resource Type: Code Snippets    Category: Validations

Posted By: Namedm       Member Level: Silver
Rating:     Points: 5



This code sample validates a given GUID using regular expressions. The IsGuid takes a string that is a global unique identifier. It checks if it fits the regular expression represented by the isGuid objects and returns a boolean value accordingly.


private static Regex isGuid = new Regex(@"^(\{){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}$");


public static bool IsGuid(string value)
{

bool isValid = false;

if (!String.IsNullOrEmpty(value))
{
if (isGuid.IsMatch(value))
{
isValid = true;
}
}
return isValid;
}




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Validation  .  Validate GUID  .  GUID validation in C#  .  GUID validation  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Validating a URL(simple!!!!!!!!!!)
Previous Resource: Noise Words
Return to Discussion Resource Index
Post New Resource
Category: Validations


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

fax server

Contact Us    Privacy Policy    Terms Of Use