Search code examples
pentahokettlepdi

Regexpression for getting a file


I have to get a file through PDI based on the filename and i want to select file with name matching pattern eligible_for_push which has to be at the end.The file can be .txt or .csv Please Help Thanks


Solution

  • There are two part to your query:

    1. Finding all files ending with "eligible_for_push":

    You cannot use regex to find this sort of pattern (at least i am not aware of). So as an alternate do the following:

    Search all the files in the path using "Get Filename" steps. Use modified Javascript to find out the file ending with the above pattern. Check the JS file below.

    enter image description here

    2. Files can be ".txt" or ".csv":

    You can use the below regex/wildcard to find choose between either .txt or .csv

    .*\.txt|.*\.csv
    

    Note : Use this code once you have filtered out the files ending with "eligible_for_push". The above JS ignore all the file patterns. After that use the second step to sort out all the .txt or .csv files.

    Hope it helps :)