import re
for x in (
'This is a sample text and this is lowercase text that is repeated.',
'abcdefabcdef bcdefab'
):
print(re.findall(r'(.{7,})(?=.*\1)', x, re.S))
aW1wb3J0IHJlCgpmb3IgeCBpbiAoCiAgICAnVGhpcyBpcyBhIHNhbXBsZSB0ZXh0IGFuZCB0aGlzIGlzIGxvd2VyY2FzZSB0ZXh0IHRoYXQgaXMgcmVwZWF0ZWQuJywKICAgICdhYmNkZWZhYmNkZWYgYmNkZWZhYicKKToKICAgIHByaW50KHJlLmZpbmRhbGwocicoLns3LH0pKD89LipcMSknLCB4LCByZS5TKSk=