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.com
For each case, check the
Regular expression
search box !Best Regards,
guy038
-