0

I have a scenario where i am taking files from a folder for data loading which is having naming convention as .Customer_..txt.But also i would like to make this expression case insensitive so if any file named CUSTOMER_1234 comes.It will also accept that and process accordingly

Coding_line
  • 127
  • 4
  • 15

1 Answers1

1

Try the below regex:

(?i)customer(?-i).*\.txt

in the wildcard section of the "get files" steps or any other regex step you are using. This will filter out files starting with either "customer" or "CUSTOMER".

Attached a sample code here.

Hope this helps :)

Sample Screenshot:

enter image description here


Modifying my previous answer based on the comment below:

If you are looking to match the pattern "customer_" irrespective of case sensitivity, first of all you can easily do it using a Javascript "match" function. You just need to pass the file names in upper case and match with the uppercase pattern. This will easily fetch you the result. Check the JS snip below:

var pattern="customer_"; //pattern is the word pattern you want to match

var match_files= upper(files).match(upper(pattern)); // files in the list of files you are getting from the directory

if(upper(match_files)==upper(pattern)){
      //set one flag as 'match'
}
else{
     // set the flag as 'not match'
}

But in case you need to use regex expression only. Then you can try the below regex:

.*(?i)(customer|CUSTOMER).*(?-i)\.txt

This would work for "_123_Customer_1vasd.txt" patterns too.

Hope this helps :)

Rishu Shrivastava
  • 3,745
  • 1
  • 20
  • 41
  • Hi rishu this is fine..But in case of any file coming as 12346_customer_gdhdhdjdjd.txt..in this case itc wont work..i want the file having name customer_ as case insensitive,,please respond if u know – Coding_line Jan 26 '15 at 17:18
  • @DebayanBhattacharjya check the modified answer above. – Rishu Shrivastava Jan 27 '15 at 09:31