I have a set of file names that contain within the name an ID number. These ID numbers do not necessarily have the same character length. Any ideas on how to achieve this? This is what I have for fixed ID character length.
For (k =1, k < N Items( listOfFiles ), k++, IDNumber = subsr( listOfFiles, 1, 8 ); insertinto( listOfIDNumbers, IDNumber ); );
Issue arises when ID number is not 7 characters in length and I have complex filenames. ABCDE_1234567_ABCD.csv ABC_123_ABCDEFG.csv
What I want is to just get 1234567 and 123. Can I key off .csv somehow or perhaps underscore?
The other option would be to leverage regular expressions. If the file names did not have _'s separating the various portions but the ID name was uniquely composed of numbers and the rest of the file name did not contain numbers then this would work.
A regex syntax guide that I always reference is: http://www.regular-expressions.info/reference.html