def subs(txt, startswith):
    for i in range(len(txt)):
        for j in range(1, len(txt) - i + 1):
            if txt[i].lower() in startswith.lower():
                yield txt[i:i + j]
s = 'BANANA'
vowels = 'AEIOU'
print(sorted(subs(s, vowels)))
Find all possible substrings begining with characters from capturing group