import re str = "this is a really weird test" words = re.findall(r"\b[^aeiouy\W]*[aeiouy][^aeiouy\W]*\b", str) print(words)
Standard input is empty
['this', 'is', 'a', 'test']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!