Announcement: Launch of Powerful Code Scripts to Simplify Development
October 10, 2025
Here we will look, at how we can hide some parts of email id using javascript.
function partialEmail(email) {
let partialEmail = '';
if (email) {
partialEmail = email.replace(/(\w{3})[\w.-]+@([\w.]+\w)/, '$1***@$2');
}
return partialEmail;
}
partialEmail('hello@gmail.com');
Result:
hel***@gmail.com