partially mask a email address – javascript

You could seach for a group of four characters and replace a group of two until you found an @ sign-

    mask = string => string.replace(
        (_, a, b) => a + '*'.repeat(b.length)

console.log(mask('[email protected]'));

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top