REMatchGroups() ColdFusion User Defined Function

<!--- Crate the text that we will search. --->
<cfsavecontent variable="strText">
	Jill: 212-555-1234
	Sarah: 917.538.0001
	Maria: 212.538.1234 x14
	Kim: 212.555.5432 x5435
</cfsavecontent>
 
 
<!--- Collect the phone numbers. --->
<cfset arrMatches = REMatchGroups(
	strText,
	"(\d+)[. \-]?(\d+)[. \-]?(\d+)(?: x(\d+))?"
	) />
 
 
<!--- Dump out results. --->
<cfdump
	var="#arrMatches#"
	label="REMatchGroups() Results Array"
	/>

For Cut-and-Paste