The requirement is as below:
Input: rajani@gmail.comOutput: r****i@*****.com
I tried below two regex's but I could not able to mask the gmail(domain name). Kindly help me on this.
String masked_email_Address2=email_Address.replaceAll("(?<=.{1}).(?=[^@]*?.@)", "*");
Output received as r****i@gmail.com
I searched in stack overflow on this, I got the below regex but it does not produce the correct result:
String masked_email_Address1=email_Address.replaceAll("\\b(\\w)[^@]+@\\S+(\\.[^\\s.]+)", "$1***@****$2");
Output received as: r***@****.com
-- One star(*) is missed between R&@.