I would like to open a dialog box to select a file and show all files with a certain extension, but exclude certain filenames based on pattern match (regex or otherwise).
For example, I want to show CSV files, but not ones that have 'abc' in their filename.
To show ALL .csv files I can do (NOT what I want):
[filename, pathname] = uigetfile({'*.csv', 'CSV Files (*.csv)'});
With regular expressions, I can successfully exclude filenames with 'abc' as follows (thanks to How to negate specific word in regex?):
filenames = {'myfile.csv'; 'myfile-abc.csv'}
regexp(filenames, '^(?!.*abc).*.csv')
However, the following does not work:
[filename, pathname] = uigetfile({'^(?!.*abc).*.csv', 'CSV Files (*.csv)'});
How can I negate a word from occuring in the filename? It seems I can only do positive wildcards (*) but not negation.