%% Match m-File names From Specified Directory
% Use wildcardPattern to match m-files with any name in a specified directory.
% Build a pattern, pat, that matches any file names in the specified directory and ending in ".m". Extract the pattern.

STR = [ "C:\Users\joe\files\short pattern.m"
        "C:\Users\joe\files\really_long_name_pattern.m"
        "C:\Users\joe\files\just\right\pattern.m"];
PAT = "files\" + wildcardPattern + ".m";
extract(STR,PAT)

% Copyright 2020 The MathWorks, Inc.