import re
s = 'Helllo<BckSp><BckSp>o world'
r = re.compile('^(?:<BckSp>)+|.<BckSp>', flags=re.S)
while r.search(s):
    s = r.sub('', s)
print(s)
Match same number of repetitions of character as repetitions of captured group