import re

print re.findall('[a-z]+\.(?:txt|html)', 'abc.txt def.html')