Obtaining substrings with variable number of characters
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?