Hi all,
I need regex for below picture please help me to find out solution.
From above image I need output,
123
1234
12344
12345
I need number contain starting of file name before underscore.
Thanks,
Vicky
Hi all,
I need regex for below picture please help me to find out solution.
From above image I need output,
123
1234
12344
12345
I need number contain starting of file name before underscore.
Thanks,
Vicky
HI @Vicky_K
Use the belwo:
Input= "123_INVU_3232233445.txt"
Output= System.Text.RegularExpressions.Regex.Match(Input "\d+").Value
Or else use the below linq query:
-> Assign -> Arr_FilesinFolder = System.IO.Directory.GetFiles("Give the Folder path here")
-> Assign -> Output_FileNames = String.Join(Environment.NewLine,Arr_FilesinFolder.AsEnumerable.select(Function(X) System.IO.Path.GetFileName(X).ToString.Split("_").First).toarray())
Note - Arr_FilesinFolder is the Array of String datatype variable
Output_FileNames is the String datatype variable
Regards
If it is always starting and before undwrsscore
You can use
Filename.Split("_"c).First
Cheers
Hey @Vicky_K , try using this regex:
\d+(?=_)

You can try using this:
System.Text.RegularExpressions.Regex.Matches((“String Containing file names”),“\d+(?=_)”)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.