I am attempting to try and extract two separate strings from a file name in a directory path - I am able to extract the file name from the path but I want to be able to extract two separate substrings that is beween the last “/” and first underscore symbol _, and the second substring is between the first underscore symbol _ and second _
An example path would be: “C:\Users\Robot\Documents\UiPath\ExtractedFolder\123456_78912345_Test_File_2020.pdf”
So the first substring would be - 123456
Second substring - 78912345
I managed to get the entire file name alone but need to extract two substrings from the file name.
Closest I was able to get was: file.ToString.Substring(file.ToString.LastIndexOf(“")+”_".Length).Split(Environment.NewLine.ToCharArray)(0)
Any suggestions would be great please.