I am trying to write a regular expression to mask an email address. Example below.
input: john.doe@example.en.com
output: j*******@e*********.com
I have tried the following but I just can't seem to get it working correctly.
regex:
(?<=.).(?=[^@]\*?@)
output:j*******@example.en.com
regex:
(?<=.).(?=[^@]\*?)(?=[^\.]\*?\.)
output:j******************.com
Any help would be appreciated. demo