RESwitch / RECase ColdFusion Custom Tags For Regular Expression Switch Statements

<!--- Set a value to test (quoted string). --->
<cfset strValue = """Hey Sugar""" />
 
 
<!--- Check to see what kind of value we are working with. --->
<cf_reswitch expression="#strValue#">
 
	<cf_recase
		pattern="^(\d+)\.(\d)+$"
		group1="intInteger"
		group2="intDecimal">
 
		Float found: #intInteger#.#intDecimal#.
 
	</cf_recase>
 
	<cf_recase pattern="^\d+$">
 
		Integer found: #strValue#.
 
	</cf_recase>
 
	<cf_recase
		pattern="^([^@]+)@(.+)\.(\w{2,})$"
		group1="strName"
		group2="strDomain"
		group3="strExtension">
 
		Email found: #strName#@#strDomain#.#strExtension#.
 
	</cf_recase>
 
	<cf_recase
		pattern="^(""([^""]+)""|([^""]+))$"
		group2="strQuotedValue"
		group3="strNonQuotedValue">
 
		<cfif Len( strQuotedValue )>
 
			Quoted string found: #strQuotedValue#.
 
		<cfelse>
 
			Non-Quoted string found: #strNonQuotedValue#.
 
		</cfif>
 
	</cf_recase>
 
	<!--- Default case. --->
	<cf_recase pattern="^[\w\W]*$">
 
 
		Unknown string value found: #strValue#.
 
	</cf_recase>
 
</cf_reswitch>

For Cut-and-Paste