REReplace() + Java + Function Pointers = Freakin' Sexy!

<cffunction name="REReplaceHelper" access="public" returntype="string" output="false"
	hint="Evaluates the matches in a JREReplace and returns a value.">
	 
	<!--- Define arguments. --->
	<cfargument name="Match" type="string" required="true" />
	<cfargument name="Groups" type="array" required="false" default="#ArrayNew( 1 )#" />
	 
	<cfscript>
		 
		// The Groups argument contains an array of groups that 
		// were matched. Each group is denoted by a pair of
		// () in the matched regular expression pattern.
		// Check to see what the matched value is. For each
		// argument, we just returning a different value.
		switch ( ARGUMENTS.Match ){
			 
			case "girl":
				return( "<b>lady</b>" );
				break;
			 
			case "cute":
				return( "<b>wicked</b> cute" );
				break;
			 
			case "melons":
				return( "<b>juicy</b> melons" );
				break;
			 
			// No expected math was found.
			default:
				return( "<b>??</b>" );
				break;
		}
	 
	</cfscript>
</cffunction>

For Cut-and-Paste