How to replace email string before @ symbol with asterisk(*) using Salesforce Formula?

How to replace email string before @ symbol with asterisk(*) using Salesforce Formula?

Sample Formula:

IF(
AND(
NOT(ISBLANK(Email)),
CONTAINS(Email, '@') 
),
LPAD(RIGHT(Email, LEN(Email) - FIND('@', Email) + 1), LEN(Email), '*'),
''
)

Output:

Leave a Reply