import re s = "aa abs aadfc asdacx adds asdwe bcadcapca" print (re.findall(r'\b(?:(?:[^a\W]*a){2})+[^a\W]*\b', s))
Standard input is empty
['aa', 'aadfc', 'asdacx']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!