11-13-2019 02:14 PM
I have a pretty simple Pipeline that gets a directory listing from Box, filters those files according to their filename, then calls Pipeline Execute to fetch the contents of the matched files using this syntax:
$FileName.match(_FILE_NAME_MATCH)!=null
Here is the filter:
I have six files in this folder:
When I set FILE_NAME_MATCH to “test” I get the two matching files:
I get the same result when I set this variable to “test*”. However, I get zero results when I set it to “test*.csv”:
I checked the same regex in JavaScript and no, it’s not a valid search query (i.e. SnapLogic is behaving as expected)
Given that my sysadmins who will be setting up the parameters for these jobs don’t know regex, is there a way for me to use simple Windows File System wildcard searching in the Filter Snap?
They may want to scan for files like this…
output??report(*).xls?
…and not have to know the regex to get it.
11-14-2019 01:31 AM
@graham-onpoint
Given that if you do not want to use the Regex and to achieve this you may need to configure two parameters.
1.The match string without file extension which you are using FILE_NAME_MATCH(in this case test)
2.File extension as FILE_EXT(in this case .csv)
With those two parameters defined you can use the expression in the filter like this.
$filename.match(_FILE_NAME_MATCH) != null && $filename.toLowerCase().endsWith(_FILE_EXT)
Hope this is helpful
11-14-2019 07:45 PM
Thank you for the suggestion. I think that I’m just going to write the regex for them.