RELoop ColdFusion Custom Tag To Iterate Over Regular Expression Patterns

<!---
	Loop over the text using the email address pattern. For
	each iteration, we are gonna use the ReturnGroups boolean
	to get a structure of the captured groups. Then, we are
	going to update the ZERO group (full match) in conjunction
	with the Variable attribute to flag that we actually want
	to update the target string.
--->
<cfmodule
	template="reloop.cfm"
	index="objMatch"
	pattern="#strRegEx#"
	text="#strText#"
	returngroups="true"
	variable="strUpdatedText">
 
	<!---
		For each email address, we want to change the COM domain
		extension to be the ORG extension. To do that, we have
		to update the ZERO group within the returned structure.
	--->
	<cfset objMatch[ 0 ] = (
		objMatch[ 1 ] & "@" &
		objMatch[ 2 ] & "." &
		"org"
		) />
 
</cfmodule>
 
<!---
	Now that we have finished looping, our Variable,
	strUpdatedText, should now have the updated text
	value.
--->
#strUpdatedText#

For Cut-and-Paste