Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

Scrub Outlook Email Addresses

Description
When you copy an Outlook contact's email address, you typically get this:
John Doe
Use this Macro to reduce this to:
john.doe@somedomain.com
Language
C#.net
Minimum Version
Created By
jerone
Contributors
-
Date Created
Aug 19, 2014
Date Last Modified
Aug 19, 2014

Macro Code

using System;
using System.Text.RegularExpressions;

public static class ClipboardFusionHelper
{
    public static string ProcessText(string text)
    {
        Regex email = new Regex(@"[<\[](?<email>[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4})[>\]];?", RegexOptions.IgnoreCase);
        string textNew = text;
        if (email.Match(text).Success)
        {
            textNew = "";
            foreach(Match match in email.Matches(text))
                textNew += match.Groups["email"] + " ";
        }
        return textNew;
    }
}