Splitting string error

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”.
“ACHDR Present2_R” This is enough

@Sudharsan_Ka “ACHDR Present2_R”

Have you tried with regex?

1 Like

No i didn’t try using regex I am trying using substring and split functions.

@HeartCatcher can you try below regex pattern ?


It seems to be working regex101: build, test, and debug regex

1 Like


I am new to uipath can you please guide whether it is correct which is in photo.??

If you need you can try this here is the regex

Here is the workflow with split
Sample.xaml (5.6 KB)


1 Like


Another solution:

arrStr = yourString.Split("-"c)




1 Like

시퀀스4.xaml (6.8 KB)

1 Like


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

1 Like

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


Ok thanks.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.