Heh... I totally forgot about Repeatstring()... <cfscript> function maskemail(email) { name = listfirst(email, '@'); tld = listlast(email, '.'); maskedemail = name & '@' & repeatstring('*', len(replace(replace(email, name, ''), tld, ''))-2) & '.' & tld; return maskedemail; } </cfscript>
<cfoutput>#maskemail('[EMAIL PROTECTED]')#</cfoutput> ....and this one actually uses the variables I set hehe -----Original Message----- From: RichL [mailto:[EMAIL PROTECTED] Sent: Monday, October 30, 2006 8:39 AM To: CF-Talk Subject: Re: Need regular expression in REReplace for email Hi Karl My regular expressions are very rusty to say the least.. but I had a go using string manipulation which you could put in to a UDF.... seems to work ok with a variety of emails and may at least get you started. I am sure that there is a better/easier way probably using regular expressions... <cffunction name="emailStars" returntype="string"> <cfargument name="email" required="yes" type="string"> <cfset atPosition = find("@",email)> <cfset lastPeriod = Len(listLast(email, ".")) + 1> <cfset starlength = Len(email) - (lastPeriod) - atPosition> <cfset stars = repeatstring("*",starlength)> <cfset emailStar = left(email,atPosition) & stars & "." & listLast(email, ".")> <cfreturn emailStar> </cffunction> <cfset Email = "[EMAIL PROTECTED]"> <cfset newEmail = emailStars(email)> <cfdump var="#variables#"> <cfoutput>#email# (original)<br />#newEmail# (stars)</cfoutput> -- No virus found in this outgoing message. Checked by AVG Free Edition. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258451 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4