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 expressions!
Regular Expressions example – removing text before the @ in email address list
- Export Blocked Senders list from Outlook
- Home > Junk > Junk Email Options > Blocked Senders > Export to file > ihatespam.txt
- Open file in Notepad ++
- Ctrl + F for Find
- Choose Replace tab
- Search Mode = Regular Expressions
- Find What = .*@(.*)
- Replace with = \1
- Import the new list into Outlook Blocked Senders
- Home > Junk > Junk Email Options > Blocked Senders > Import from file ( ihatespam.txt )
List before
- spammer@ihatespam.com
- sendusmoney@lol.com
- hellosucker@takeittothebank.com
List After
- ihatespam.com
- lol.com
- takeittothebank.com
http://markantoniou.blogspot.com/2008/06/notepad-how-to-use-regular-expressions.html