Created
May 22, 2012 01:07
-
-
Save randomweapon/2765842 to your computer and use it in GitHub Desktop.
Coldfusion function to validate a string to see if it is a UUID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- | |
Function Name : validateUUID() | |
Author : Ryan Spencer | |
Created : 13/02/2009 | |
General Notes : | |
Function in : | |
uuid | string | |
Function return : | |
boolean | true / false | |
---> | |
<cffunction name="validateUUID"> | |
<cfargument name="uuid" default=""> | |
<cfscript> | |
if ( NOT reFindNoCase( "([0-9A-Z]{8})+\-([0-9A-Z]{4})+\-([0-9A-Z]{4})+\-([0-9A-Z]{16})", arguments.uuid ) OR (len(trim(arguments.uuid)) NEQ 35) ) | |
return false; | |
else | |
return true; | |
</cfscript> | |
</cffunction> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment