How can I partially hide email address like this in Javascript?
examplemail@domain.com => ex**pl**ai*@domain.com
I have modify the below code, but can get the result that I need, it's just return this result:
exam*******@domain.com
email.replace(/(.{4})(.*)(?=@)/, function (gp1, gp2, gp3) {
for (let i = 0; i < gp3.length; i++) {
gp2 += "*";
}
return gp2;
});