REReplace ColdFusion Custom Tag - Another Regular Expression Experiment

<!--- Store content to replace. --->
<cfsavecontent variable="strText">
 
	Have you ever been to www.bennadel.com? It's a wicked cool
	site. If you haven't you might want to check out
	http://www.bennadel.com/projects/; it has a list of neat
	ColdFusion-based projects that Ben is working on.
 
</cfsavecontent>
 
 
 
<cf_rereplace
	text="#strText#"
	pattern="(?i)(http://)?(www\.[\w\-\./]+[\w|/])"
	returnvariable="strText">
 
	function( $0, $1, $2 ){
		// Check to see if the first group was found (the HTTP)
		// part of the URL. If not, then we need to add it to
		// the HREF so that the link doesn't stay internal.
		if (Len( $1 )){
 
			return( "<a href=""#$0#"" target=""_blank"">#$0#</a>" );
 
		} else {
 
			return(
				"<a href=""http://#$0#"" target=""_blank"">#$0#</a>"
				);
 
		}
	}
 
</cf_rereplace>
 
 
<!--- Output updated content. --->
<cfoutput>
	#HtmlEditFormat( strText )#
</cfoutput>

For Cut-and-Paste