I have a string that may have a repeated character pattern, e.g.
\'xyzzyxxyzzyxxyzzyx\'
I need to write a regex that would replace such str
How (using re module) write function, that remove all duplications.
import re def remove_duplications(string): return re.sub(r'(.+?)\1+', r'\1', string)