cancel
Showing results for 
Search instead for 
Did you mean: 

Regular expression for excluding files in SFTP adapter

PavanKumar
Active Contributor
0 Kudos

Hi,

I am using SFTP sender adapter to pick the files where i am having requirement pick some files and exclude some files.

I need to pickup the files with this name (.xml.asc) such as WPS_SIB_00000250_SH010100010001.xml.asc

and excludes the files which ends with _hot.xml.asc, _bad.xml.asc

WPS_SIB_00000250_SH010100010001_hot.xml.asc

WPS_SIB_00000250_SH010100010001_bad.xml.asc

Please suggest regular expression for excluding _hot.xml.asc, _bad.xml.asc these files.

Regards

Pavan

Accepted Solutions (1)

Accepted Solutions (1)

manoj_khavatkopp
Active Contributor
0 Kudos
  • \\*_hot.*

  • \\*_bad.*

Give these under exclusion mask

former_member186851
Active Contributor
0 Kudos
PavanKumar
Active Contributor
0 Kudos

Hi Manoj,

Also please suggest file expression for which i need pick WPS_SIB_00000250_SH010100010001.xml.asc 

I kept below one  but it is not working..

[a-z,A-Z,0-9].*\.xml.asc$


kindly suggest

manoj_khavatkopp
Active Contributor
0 Kudos

Pavan,

These to be mentioned in exclusion mask:

  • .*\\*_bad.*.*xml.*asc
  • .*\\*_hot.*.*xml.*asc

and for file name mask:

.*\\?.*xml.*asc  ( not sure on this give it a try by placing all three combination of files at once).

Br,

Manoj

Former Member
0 Kudos

You can easily try using a regex tester like this one: Regex Tester and Debugger Online - Javascript, PCRE, PHP

This regex should work: .*\d\.xml\.asc

It means:

.* = any character or nothing

\d = a digit

\. = perdiod

-->This will only capter files with a number right before ".xml.asc"

PavanKumar
Active Contributor
0 Kudos

Thanks Heiko it also got worked..

How can i test here can you please suggest as i am not aware of regular expressions

: Regex Tester and Debugger Online - Javascript, PCRE, PHP

Answers (2)

Answers (2)

Snavi
Active Participant
0 Kudos

Hi Pavan,

you can use something like

file mask  .+.xml.asc

exclusion mask  .+._bad.xml.asc|.+._hot.xml.asc

PavanKumar
Active Contributor
0 Kudos

Thanks Naveen It worked.

Former Member
0 Kudos

Hi Pavan,

If my guess is right, you are using PI 7.3.  In SFTP adapter there will be a check box "additional files"
, In that we can give a condition trigger file.name part.

Regards,

Gopi

PavanKumar
Active Contributor
0 Kudos

Hi Gopi,

I am into pi7.4  and having the option additional files.

Please suggest in my case how can i give the name to exclude those files which ends with _hot.xml.asc, _bad.xml.asc

Ryan-Crosby
Active Contributor
0 Kudos

Hi Pavan,

I believe the following regular expression for Java would take care of your requirement:

.*(?<!(_hot)|(_bad))\\.xml\\.asc

I am not an expert in regular expressions but I tested it out in Eclipse with the information that you provided and it appears to work ok.

Regards,

Ryan Crosby

PavanKumar
Active Contributor
0 Kudos

Thank you Ryan,

Small change i made then it got worked.

.*(?<!(_hot)|(_bad))\.xml.asc

Regards

Pavan

Ryan-Crosby
Active Contributor
0 Kudos

Hi Pavan,

Yes, that is because I copied directly from my Eclipse where I have to use \\ to escape the .  You would need another \ before the . that comes before asc or otherwise that will match anything like xmlyasc.

Regards,

Ryan Crosby