in reply to Re: Replacing with multiple occurrences.
in thread Replacing with multiple occurrences.

This wasn't tested, I assume, as it doesn't work as requested. Try it with my string below.

Update: To clarify: 'aaabcdabcddddddefgg' would become 'aaabcdabcddddddefg' using your version.

Update 2: Oops. I misread the question as 'all' duplicates in the string. Thanks to physi for pointing out my fault. Interesting exercise, anyway.