Find and delete text in Contacts


I have hundreds of contacts that have certain text which was added when migrating from Windows to Mac. The text is not only on Phone fields but also on Notes and Email fields.

In most cases the text I need remove starts with “X-MS-OL-DESIGN;…”

I need to find and delete the complete string which is very long and it is adjacent to phone numbers or other text.

Here is an example of how it looks after a number and after a text:

Phone: (***) 1048 8888X-MS-OL-DESIGN;CHARSET…
Notes: IPADEX-MS-OL-DESIGN;CHARSET=utf-8:<card…xmlns="

In both cases I trimmed the complete text as it is very long.

The idea is to find and delete certain text in ANY Contacts field.

Going thru every contact and every field searching for what you want is not very efficient.

1st I would do a search for your desired string then create a group from those contacts.

2nd I would narrow down which “variables” or fields contain those items. And make a note of those.

In your script go thru each contact in that group. Then loop thru each of your desired fields of that contact.

Test if the field contains your remove string.
If it does clean it and replace it.
I’d recommend using a RegEx for testing / replacing.

Thanks technomorph. I am new to scripts so do not know exactly how to do what you mention, that is why I was asking for help on the script.

You should be able to do the 1st two items your self in Contacts.

Once you figure out which fields.
Return and post them and myself or someone else can help you from there.