Search code examples
javaregexetltalend

Talend - Exclude files withe a specific mask


I recover from a FTP server, flat files which has these names:

  • abc
  • abc.flag
  • abc.tmp
  • test
  • test.flag
  • test.tmp

In my case, I have to recover just the files: abc and test. I tried with the following mask but it did not work: "(.+\.tmp)| (. + \.flag) " is there another way to do this ?


Solution

  • Can't find of an expression that would select all but .tmp and .flag files, but here's an example to select them, which uses .+(?:flag|tmp)$.

    Updated

    Assuming negative lookaheads are allowed, see this example that only selects non .tmp and .flag files, which uses

    ^.+\.(?!flag|tmp).+$|^\w+$