based on your provided example you can try something like this:
your base search here to get the list
| rex field="Filename" "\.(?<extension>[^\.]*$)"
| search extension="txt" OR extension="exe" | ...
This will create the extension field using the regex to match everything after the last . which is not a ., search for extension txt or exe and you can use it to process further down the Splunk search.