Skip to main content
Question

Using regular expressions in the Source FME Feature Store Files Parameter


I am trying to use wildcards/regular expressions to identify multiple FFS files to read through one FFS reader in the FME workbench.  If I use something like "C:\\SomeDir\\*83.ffs", the FFS reader reads all files that end in 83.ffs in the SomeDir directory.  I can even use "C:\\SomeDir\\*8[345].ffs" to read all files that end in 83.ffs, 84.ffs, or 85.ffs.  Now I want to read all files that end in 11.ffs or 83.ffs.  When I try "C:\\SomeDir\\*(11|83).ffs", I get an error message "Invalid FFS dataset directory 'C:\\SomeDir\\*(11|83).ffs'".  I have also tried a comma, semi-colon, or space separated list of filenames to no avail.  Is this possible or do I need to create two FFS readers?

 

 

Any suggestions would be appreciated!  I'm using FME Desktop 2013 SP1.

 

 

Steve

 

 

 

3 replies

takashi
Supporter
  • April 13, 2013
Hi Steve,

 

 

I think it's impossible to use such a regular expression in the reader settings. But we can set comma-separated two or more paths in the "Dataset" text box of a reader, so you can use the following expression instead: C:\\SomeDir\\*11.ffs,C:\\SomeDir\\*83.ffs   To get this expression, you can edit "Dataset" text box directly, or do: 1) Click [+] button of the "Add Reader" dialog box to open advanced browser. 2) Add two "C:\\SomeDir" rows. 3) Change "File/Filter" column values to "*11.ffs" and "*83.ffs". 4) Click [OK] to close the browser.   Takashi

  • Author
  • April 15, 2013
Thanks for the help Takashi.  Since I am using a Python script to generate the fully pathed file name, my return value from the script needs to match the format genrated by entering the two lines in the advanced file browser dialog:

 

 

""C:\\SomeDir\\*11.ffs" "C:\\SomeDir\\*83.ffs""

 

 


david_r
Evangelist
  • April 15, 2013
Hi Steve,

 

 

consider doing the wildcard matching in your python script and then returning the complete list of files to process, without any wildcards.

 

 

You can use the module glob to do this quite easily.

 

 

David

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings