Disable regular expression in tFTPDelete

Six Stars

Disable regular expression in tFTPDelete

I have xml file names such as 1[.xml and CUP-[3000011769]-20180208142225.xml.

It is taking "[" bracket as regular expression. How to disable regular expression at FileMask.

 

filemask.PNG

Tags (1)

Accepted Solutions
Nine Stars

Re: Disable regular expression in tFTPDelete

You can use this in the filemask :

java.util.regex.Pattern.quote(((String)globalMap.get("tFileList_1_CURRENT_FILE")))

This command will escape characters from the Filename.

It produces an escaped RegEx so don't forget to tick the "Use Perl5 Regex Expressions as Filemask" checkbox


All Replies
Nine Stars

Re: Disable regular expression in tFTPDelete

Hi,

 

you may uncheck the "Use Perl5 Regex Expressions as Filemask" and it will only take 2 wildcard characters: "*" for anything and "?" for a single character.

 

Regards

Six Stars

Re: Disable regular expression in tFTPDelete

Although i uncheck "Use Perl5 Regex Expressions as Filemask", it is not working. It catches bracket "[" as expression. I want to delete by current file name "((String)globalMap.get("tFileList_1_CURRENT_FILE"))".
Nine Stars

Re: Disable regular expression in tFTPDelete

You're right, my bad. It seems that when unchecking, it uses this library to convert to Perl5 regex.

And according to the documentation, it support brackets notation from the Unix shell.

 

Unless you want to update the default component, I think you will have to work on the filename.

You might either escape only brackets (.replaceAll(...)), or you can use a more generic method such as Pattern.quote.

Six Stars

Re: Disable regular expression in tFTPDelete

Can you explain more on how to do it? Any way to disable regular expressions?

Nine Stars

Re: Disable regular expression in tFTPDelete

You can use this in the filemask :

java.util.regex.Pattern.quote(((String)globalMap.get("tFileList_1_CURRENT_FILE")))

This command will escape characters from the Filename.

It produces an escaped RegEx so don't forget to tick the "Use Perl5 Regex Expressions as Filemask" checkbox

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

APIs for Dummies

View this on-demand webinar about APIs....

Watch Now