How to Extract Emails From an Outlook Distribution Group

On one of my recent projects, I had to compare active users against an Outlook distribution group. Talk about a nightmare! I’m not an Exchange admin so I couldn’t quickly export the group as a CSV and extract the required information.

After spending a bit of time in Outlook to see if groups could be exported I went in another direction. I wanted REGEX to solve my problems. Yes, the strange, confusing, mysterious, and powerful REGEX. And I wanted Notepad++ to do it for me. After spending a bit of time looking for the right solution, I found it.

So, dear reader, here’s how to extract just the emails from an Outlook distribution group.

  1. Open a new Outlook message and type in the distribution group name.
  2. Expand the distribution group so that you see all of the members.
  3. Copy all of the members to Notepad++. You will get something like the following:
  4. Our next goal is to get the email addresses on a separate line so we can mark them and then remove all other content. Start by pressing CTRL + H (find and replace). Under Find what type the left bracket ‘<‘. In the Replace with type in ‘\r\n’ which will create a new line break. Ensure to select the Search Mode ‘Regular expression’. Click Replace All. You should see the following:
  5. Perform the same step as described above but using the right bracket ‘>’.
  6. Now, we will use REGEX to find the email addresses and mark them.
  7. In the Replace dialogue box click the Mark tab. In Find what paste the following REGEX:
  8. Ensure the Bookmark line is enabled. Click Mark All. It should look something like this:
  9. Only one more step to go! Click Search > Bookmark > Remove Unmarked Lines.

You’re done! The final result is a nice looking list that you can copy and paste into Excel or Google Sheets and use conditional formatting to compare against another list (or whatever you needed the emails for in the first place)!

2 thoughts on “How to Extract Emails From an Outlook Distribution Group”

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.