Problem: Find all vowels (more than 2) that are sandwiched between two consonants. These vowels can come at beginning or end of line. Example:-
input :-
abaabaabaabaae
expected output :-
['aa','aa','aa','aae']
solution Tried
import re
pattern=re.compile(r'(?:[^aeiouAEIOU])([AEIOUaeiou]{2,})(?=[^AEIOUaeiou])')
pattern.findall("abaabaabaabaae")
This gives output as ['aa','aa','aa'] , it ignores 'aae' for obvious reason as end of line is not part of search criteria. How can I include an anchor - end of line ($) inclusive search such that it($) is an OR condition in the search and not an mandatory end of line.