lists = [[1, 1, 1, 1, 1, 1], [4, 1, 4, 1, 4, 1], [1, 2, 10, 1, 2, 10], [1, 
    1, 1, 1, 1, 4, 1, 4, 1, 20, 9, 8, 1, 1, 1, 1, 1, 4, 1, 4, 1, 20, 9, 8],
    [2, 2, 2, 4, 2, 2, 2, 4], [1, 1, 1, 13, 21, 45, 3, 3, 1, 16, 4, 1, 4, 1,
    1, 1, 24, 15, 1, 1, 1, 13, 21, 45, 3, 3, 1, 16, 4, 1, 4, 1, 1, 1, 24, 
    15], [1, 1, 1, 3, 28, 1, 1, 1, 3, 28, 67, 25, 1, 1, 1, 3, 28, 1, 1, 1, 
    3, 28, 67, 25]]
for l in lists:
    s = 'x'.join(str(i) for i in l)
print(s)
match = re.match('^(?P<foo>.*)x?(?P=foo)', s)
if match:
    print(match.group('foo'))
else:
    print('****')
print()
Python finding patterns within large group of numbers?