on-internet
← Community

Regular expression for email masking

Stack Overflow ·

I am trying to write a regular expression to mask an email address. Example below. input: [email protected] 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

Comments

Sign in or sign up to comment and upvote.

No comments yet.