import re
s = 'Helllo\x08\x08o world'
r = re.compile('^\x08+|[^\x08]\x08')
while r.search(s):
    s = r.sub('', s)
print(s)
Match same number of repetitions of character as repetitions of captured group