generate regex code: https://regex101.com/
# find all consecutive charactors str_ls = [ match[0] for match in re.findall(r'((.)\2{0,})', string) ]