Search code examples
emailreplaceasp-classic

CLASSIC ASP: Replace all characters from email string - less @ and "."


I'm trying to replace all characters from an Email String - less @ and "." with Classic ASP

Something like this:

JOHN.DOE@EMAIL.COM 
****.***@*****.***

CARL_SAGAN@EMAIL.COM
**********@*****.***

I Try with "REPLACE(EMAIL, J, *)" - but with this I need to replace each characters (and this includes special characters too, like "_" "-" and others..)

There is any other alternative?

tks!

== UPDATE:

I'm got a better solution with REGEX:

Dim regEx
Set regEx = New RegExp
regEx.Pattern = "[A-Za-z]"
regEx.Global = True
tipEmail = regEx.Replace(Email, "*")

But I'm not so expert. This RegEX Pattern excludes AZ/az and I need to exclude ALL characters - less @ and "."

tks.


Solution

  • I got it!

    the solution -

    Dim regEx
    Set regEx = New RegExp
    regEx.Pattern = "[^@.]"
    regEx.Global = True
    tipEmail = regEx.Replace(Email, "*")