import re
def findall_overlapped(r, s):
res = [] # Resulting list
reg = r'^{}$'.format(r) # Regex must match full string
for q in range(len(s)): # Iterate over all chars in a string
for w in range(q,len(s)): # Iterate over the rest of the chars to the right
cur = s[q:w+1] # Currently tested slice
if re.match(reg, cur): # If there is a full slice match
res.append(cur) # Append it to the resulting list
return res
rex = r'\d+'
print(findall_overlapped(rex, '01'))
aW1wb3J0IHJlCgpkZWYgZmluZGFsbF9vdmVybGFwcGVkKHIsIHMpOgogIHJlcyA9IFtdICAgICAgICAgICAgICAgICAgICAgIyBSZXN1bHRpbmcgbGlzdAogIHJlZyA9IHInXnt9JCcuZm9ybWF0KHIpICAgICAgIyBSZWdleCBtdXN0IG1hdGNoIGZ1bGwgc3RyaW5nCiAgZm9yIHEgaW4gcmFuZ2UobGVuKHMpKTogICAgICAjIEl0ZXJhdGUgb3ZlciBhbGwgY2hhcnMgaW4gYSBzdHJpbmcKICAgIGZvciB3IGluIHJhbmdlKHEsbGVuKHMpKTogICMgSXRlcmF0ZSBvdmVyIHRoZSByZXN0IG9mIHRoZSBjaGFycyB0byB0aGUgcmlnaHQKICAgICAgICBjdXIgPSBzW3E6dysxXSAgICAgICAgICMgQ3VycmVudGx5IHRlc3RlZCBzbGljZQogICAgICAgIGlmIHJlLm1hdGNoKHJlZywgY3VyKTogIyBJZiB0aGVyZSBpcyBhIGZ1bGwgc2xpY2UgbWF0Y2gKICAgICAgICAgICAgcmVzLmFwcGVuZChjdXIpICAgICMgQXBwZW5kIGl0IHRvIHRoZSByZXN1bHRpbmcgbGlzdAogIHJldHVybiByZXMKCnJleCA9IHInXGQrJwpwcmludChmaW5kYWxsX292ZXJsYXBwZWQocmV4LCAnMDEnKSk=