I need a regex to obfuscate emails in a database dump file I have. I'd like to replace all domains with a set domain like @fake.com
so I don't risk sending out emails to real people during development. The emails do have to be unique to match database constraints, so I only want to replace the domain and keep the usernames.
I current have this regex for finding emails
\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b
How do I convert this search regex into a regex I can use in a find and replace operation in either Sublime Text or SED or Vim?
EDIT:
Just a note, I just realized I could replace all strings found by @[A-Z0-9.-]+\.[A-Z]{2,4}\b
in this case, but academically I am still interested in how you could treat each section of the email regex as a token and replace the username / domain independently.