Your job is to write a function:
Function AnalyzeData(const Data : String; Var List : TStringList) : Boolean;
The function takes as an input the Data string which will contain 0..N number of filenames (e.g. '@c:\foobar\foo\[url removed, login to view] -run' or '%window%\[url removed, login to view] /silent') and directory paths (e.g. 'path=%windir%\fonts\', '@"c:\foobar\" -foo'). The input string can contain any random characters with the filenames and directory paths.
The function must return True if one or more valid looking filenames or directory paths was detected from the input string. In such case, these are added to the given List. If no valid looking filenames or paths were found, then List is not modified and False is returned.
The function can use CommonFileExts : TStringList; which contains a sorted, duplicate-free list of most common file extensions. For a sample, see the attached Tester program. The attached program contains my implementation of AnalyzeData (albeit with a bit different parameter list). Your job is to create your own implementation and make it faster and more accurate than my implementation. By accuracy I mean the ability to extract the desired filename and directory path data from the given input strings.
Note: If the input string contains environmental variables, such as "%windir%", these must be expanded. The attached Tester app contains ExpandEnvString() which you will use for this.
You can also implement the function as a member of a class, e.g. TFileNameExtractor.