Re.findall() & Re.finditer()

  • + 0 comments

    The pattern in lookbehind and lookaheads exclude consonants, whitespace, digits, non-slphanumeric and underscore.

    import re
    
    pattern = '(?<=[^aeiou\s\d\W_])([aeiou]{2,})(?=[^aeiou\s\d\W_])'
    lst = re.findall(rf'{pattern}', input(), re.IGNORECASE)
    if lst:
        print(*lst, sep='\n')
    else:
        print(-1)