简体   繁体   中英

Can't filter filenames in Talend Open Studio using regular expressions

This question is about Talend Open Studio code.

I use tSendmail component as a child job, that needs to be run when parent job fails (tFtpPut). However, in tFtpPut, file names are filtered by filename masks (for example, it will upload file named Eedoh, if I put Ee* as a mask), but in tSendMail that's not the case.

I understand that tFtpPut uses special characters from filesystem to make filename masks, and tSendMail should use Java regex. Problem is (as I saw in the source code), List.add(String) function is used to add filenames, so I can not use regex as parameter in .add function.

So, I need way to upload all files with names that match regular expression.

Btw, I have tried to change the source code (tried iterating the whole folder and adding all files whose names matches the regex), but it didn't help, an error ocured somewhere else and I was not able to track the issue.

For that problem, I would create a regexpr filter before the components (FTP and sendMail).

It is very easy with a tFilterRow component in "advanced mode". Your filter condition is inputrow.filenamefield.matches("java_regexpr") .

This external filter is the same for both components and you don't have anymore to use the specific filter of the FTP component.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM