def upper_repl(match):
    return match.group(1).upper()
re.sub('(<[^>]*>)', upper_repl, '<span> <hey <annoy!>> </span>')
"""<SPAN> <HEY <ANNOY!>> </SPAN>"""
Python how to scan string and and use upper() between two characters?