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

View solution in original post


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"))".
Highlighted
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

View solution in original post

One Star

Re: Disable regular expression in tFTPDelete

The point of good I really favor in your blog. I am a freelance web developer NYC and i provide best web design services among other companies

 

 

 

 

2019 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog