Tim, “SP_[0-9]*” will match the first lot, and “SP_INS_[0-9]*” will match the rest.
But it might be quicker to do the second batch first, matching the names simply to “SP_INS_@“ and removing them from the list when they’re done, then re-scanning for “SP_@“ to do the rest. Just a thought. Regular expressions are fantastic but can be overkill. Jeremy Jeremy Roussak [email protected] > On 29 May 2017, at 19:29, Tim Nevels via 4D_Tech <[email protected]> wrote: > > I needs some help with 2 regex expressions. > > I have to process some files in groups from a list of files. Here is an > example of the file names: > > SP_050317 > SP_050417 > SP_050517 > SP_INS_050317 > SP_INS_050417 > SP_INS_050517 > > I need to process the files that start with “SP_” and then the date as one > group. > > I need to process the files that start with “SP_INS_” and then the date in > another group. > > I will have a text array that contains all the file names. I could write some > code to brute force accomplish this, but I’d like to use regex so that I have > some flexibiltiy if the file naming scheme changes in the future. Then I’ll > only have to change the regex pattern. > > What regex pattern would I use with "Match regex" for the first group of > files? And then what pattern to use for the second group of files? > > Example Code: > > $regexPattern_t:="what do I put here" > > DOCUMENT LIST($folderPath_t;$documentNames_at) > For ($i;1;Size of array($documentNames_at)) > $documentName_t:=$documentNames_at{$i} > $processFile_b:=Match > regex($regexPattern_t;$documentName_t;1;$foundPosition_l;$foundLength_l) > If ($processFile_b) // need to process this file > // do some things to the file > End if > End for > > > Tim > > ******************************************** > Tim Nevels > Innovative Solutions > 785-749-3444 > [email protected] > ******************************************** > > ********************************************************************** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: http://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:[email protected] > ********************************************************************** ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

