cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Exclusion mask(Regular Expression) issue in SFTP Sender channel

muralichittem
Explorer
0 Kudos
1,363

Exclusion mask issue in SFTP sender channel

I have a requirement, for 2 SFTP sender channels:

1) Select only files which do not contain the string TEST anywhere in the filename(Exclusion mask )

2) Select only files containing the string TEST anywhere in the filename(File name mask)

From same source directory I need to pick the files

For the 1St case I am using Exclusion mask to exclude files such as TEST1,TEST2,TEST3,TEST4 and TEST5 I have given all these in Exclusion mask by one by one

For the 2Nd case I have given TEST1 ,TEST2 under File name mask such as .*TEST1.*

FileName: .*(dot *)

.*TEST2.*

It is working well(File name mask). But Exclusion mask is not working as expected.

I tried with couple of regex expressions but none of these are working.

Filename: .*(dot*)

(?<!TEST1).*\\.*

^(?!.*TEST1).*

Please suggest me regular expression to exclude files.

Can someone please suggest what changes I need to make in Exclusion mask to avoid picking the files?

Thanks,

Vidya

Accepted Solutions (0)

Answers (1)

Answers (1)

Ryan-Crosby
Active Contributor
0 Kudos

You could try this regular expression that uses a negative lookahead - "^((?!TEST).)*$".

 

Regards,

Ryan Crosby

muralichittem
Explorer
0 Kudos

Hi Ryan,

Thanks for your immediate response i tried with given regex expression but its not working, still the files are getting processed.

I given regex as follows ^((?!526XXXXXXX11).)*$ 

In configuration i have given right details only as ^((?!526XXXXXXX01).)*$   sorry it was my bad i posted with some change. 

My file name Eg:KAI2EOD.JG.526XXXXXXX01.20240130183258049.TXT

Please find the attached screenshot

muralichittem_0-1707317004975.png

Can you please suggest next steps?

Thanks,

Vidya.

 

 

Ryan-Crosby
Active Contributor
0 Kudos
@muralichittem it looks like your regex is off slightly and it should be ^((?!526XXXXXXX01).)*$
Ryan-Crosby
Active Contributor
0 Kudos
@muralichittem if you are using the exclusion mask then you want to exclude matches, not exclude the inverse... e.g. if you want to exclude TEST, then your exclusion mask would be .*TEST.*
muralichittem
Explorer
0 Kudos

Hi Ryan,

Now, exclusion mask is working as expected.
As i need to exclude all the files from source directory so I have given exclusion as below in source exclusion mask tab

muralichittem_0-1707486131729.png

Thank you so much for your response. 
Have a quick question when we need to use negative lookahead regex for exclusion mask?

Thanks,

Vidya.