Mask Email

Mask an email address for privacy while keeping it recognizable by showing first and last characters.

Code

Utilities
email.replace(/^(.)(.*)(.@.*)$/, (_, a, b, c) => a + '*'.repeat(b.length) + c);

Parameters

The email address to mask.

Browser·fetch() may be limited by CORS

More JavaScript Snippets