I have a set of filenames in a list like
Code:
local files "a.dat b.dat c.dat d.xlsx e.dat f.xlsx"
but there are more of them.

Is there a simple way to get a list of the files that have a certain extension? Desired result is a macro with value:
Code:
"d.xlsx f.xlsx"
More generally, this seems like a problem of getting all the words that contain a specified substring. I did not find a macro extended function that would do this. I also looked into the regular expression functions, but didn't quite see how they would work and I think they may be more complex than I need. I also didn't find anything else on Statalist about this.