Skip to content

Instantly share code, notes, and snippets.

@randomweapon
Created May 22, 2012 01:07
Show Gist options
  • Save randomweapon/2765842 to your computer and use it in GitHub Desktop.
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
<!---
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