r = re.compile('[ab]')
text = 'abcdedfe falijbijie bbbb laifsjelifjl'
matches = []
replaced = []
pos = 0
for m in r.finditer(text):
    matches.append(m.group(0))
replaced.append(text[pos:m.start()])
pos = m.end()
replaced.append(text[pos:])
print(matches)
print(''.join(replaced))
Capture the contents of a regex and delete them, efficiently