C:\Users\naveenkumar.s.clo\3D Objects\NACH\JSFB_2021-07-05-ACHDR Present2-S002 - Settlement Detail Report.xls
C:\Users\naveenkumar.s.clo\3D Objects\NACH\JSFB_2021-07-05-ACHDR Present2_R-S002 - Settlement Detail Report.xls
From i want only ACHDR Present2,ACHDR Present2_R can anyone please help me on this??
in some name contains “_R” like in this “JSFB_2021-07-05-ACHDR Present2_R”.
in Some name it wont contains “_R” like in this “ACHDR Present2-S002”.
You need the Like this?
“JSFB_2021-07-05-ACHDR Present2_R”.
or
“ACHDR Present2_R” This is enough
Have you tried with regex?
No i didn’t try using regex I am trying using substring and split functions.
@HeartCatcher can you try below regex pattern ?
[\d]{4}-[\d]{2}-[\d]{2}-(.*)-
It seems to be working regex101: build, test, and debug regex
If you need you can try this here is the regex
And
Here is the workflow with split
Sample.xaml (5.6 KB)
Regards,
Sudharsan
Hi,
Another solution:
arrStr = yourString.Split("-"c)
then
arrStr(arrStr.Length-3).Trim
Regards,
Actually file name look as in the photo it is not static, some time the file will going change.
I just need the data in between “JSFB_2021-07-05-” and “-S002 - Settlement Detail Report” these two are same in every file.
try this in log message
System.Text.RegularExpressions.Regex.Match(str_input,"[\d]{4}-[\d]{2}-[\d]{2}-(.*)-").Groups(1)
Then You can use this inside the for each
Directory.getFiles(“C:\Users\naveenkumar.s.clo\3D Objects\NACH”)
And here is the sample workflow
Sample.xaml (6.1 KB)
@Sudharsan_Ka , thanks very much for your response, it is working fine now. may I know Split(Demo,“-”)(3): what does it do
I know that split is a function, Demo is variable and splitting based on “_” but what does (3) is stands for. please dont mind i am asking too much
If we use like this it will be in array type
So for that i have given the array index there
Regards,
Sudharsan
Ok thanks.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.