Re.findall() & Re.finditer()

  • + 0 comments

    In case you are having issues like me to check if the iterator it's empty with the solutions here:

    import re
    matches = re.finditer(r"(?<=[^aeiouAEIOU])([aeiouAEIOU]{2,})(?=[^aeiouAEIOU])", input())
    found = False
    
    for word in matches:
        print(word.group(1))
        found = True
    if(not found):
        print(-1)