Regex – Notepad++ – Outlook Junk Mail

So I was pretty spam free at work for about 5 years, then I signed up for a VDI seminar. Boom, headshot. I was using Outlook to add all the spam to a Junk mail list but noticed much of it was from the same domain using various subdomains and addresses.  I had hundreds of addresses blocked, but the domains kept using new addresses. Outlook allows you to export your Junk mail list. Outlook allows you to block entire domains using “domain.com”. So the challenge was how to take all my email@domain.com entries and change them to @domain.com. How to strip anything before a fixed character? Enter Notepad ++ and regular exporessions!

Regular Expressions example – removing text before the @ in email address list

  1. Export Blocked Senders list from Outlook
    • Home > Junk > Junk Email Options > Blocked Senders > Export to file > ihatespam.txt
  2. http://www.gfisk.com/

  3. Open file in Notepad ++
  4. Ctrl + F  for Find
  5. Choose Replace tab
  6. Search Mode = Regular Expressions
  7. Find What =   .*@(.*)
  8. Replace with =   \1
  9. Import the new list into Outlook Blocked Senders
    • Home > Junk > Junk Email Options > Blocked Senders > Import from file  ( ihatespam.txt )
Notepad ++ Regex replace before

List before

  • spammer@ihatespam.com
  • sendusmoney@lol.com
  • hellosucker@takeittothebank.com

List After

  • ihatespam.com
  • lol.com
  • takeittothebank.com
Excellent article for many Regular Expression example using Notepad ++
http://markantoniou.blogspot.com/2008/06/notepad-how-to-use-regular-expressions.html
print

Leave a Reply

Your email address will not be published. Required fields are marked *