String manipulation for file path

Hi all.
I have a file path as below and need to get only the number 640419 . Can you help?
“C:\Users\Dany\Documents\UiPath\Generate Yearly Report for Vendor\Data\Temp\Invoice-640419 .pdf”

Use Regex :- \d+
This will give you only numeric
activity name : IsMatch in UiPath

1 Like

Hi @Dinesh_Babu_S,

Please use a split operation, where, you read the file name in a string.
Str = “C:\Users\Dany\Documents\UiPath\Generate Yearly Report for Vendor\Data\Temp\Invoice-640419 .pdf”
Str= str.Split("-“c)(1).Split(”."c)(0)

This will give the second part of the split string.

1 Like


Another solution :


It’s no problem even parent directories have numeric character(s).



Hi Lakshay.
I tried it but instead using match activity along with message box.
But the out put is as below.

Hi yoichi . Thank you.
It worked :smiley:

1 Like

Hi songoel . Thank you.
It worked :smiley:

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