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>

On 10/30/06, Karl <[EMAIL PROTECTED]> wrote:
> I need to take any email address and transform it with a regular expression
> in a REReplace so that everything after the @ and before the FINAL period
> is replaced by the same number of asterisks as there are characters being
> replaced.  So for example:
>
> [EMAIL PROTECTED] => [EMAIL PROTECTED]
>
> [EMAIL PROTECTED] => [EMAIL PROTECTED]
>
> [EMAIL PROTECTED] => [EMAIL PROTECTED]
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.408 / Virus Database: 268.13.17/505 - Release Date: 10/27/06
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:258420
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to