Regex mask a list of emails?
-
Hey guys,
In a list of emails (one per line), similar to this:

How to use regex to mask the emails (for GDPR) by replacing every character between the first and last before @ with * ?
So we get this:

Or alternatively, just insert a set number of asterisks (for example, 5) after the first character and @, like this:

I’ve been struggling with this the whole morning and got nowhere…
Please help :(
(images used because of Akismet marking the post as spam otheriwse)
-
Hello, @kraddock and All,
-
For your first goal, I propose this regex S/R :
-
SEARCH
(?!^).(?=.*.@) -
REPLACE
*
-
And you end up with this OUTPUT text :
e****1@gmail.com s***********l@icould.com t********l@yahoo.com
-
For your second goal, I propose this regex S/R :
-
SEARCH
(?!^).(?=.*@) -
REPLACE
*
-
And you end up with this OUTPUT text :
e*****@gmail.com s************@icould.com t*********@yahoo.comFor each case, check the
Regular expressionsearch box !Best Regards,
guy038
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login