JDK
(Josef R.)
1
Hi friends
Any one who can help me out with a small regex?
I need to identify filename fom filepath
Example of filepath:
DIRABC\FolderNameABC\BillSegmentIDIdentifier.xlsx
I want output : BillSegmentIDIdentifier.xlsx
Path can vary - but file will always be .xlsx :))
mz3bel
(Mohssine HILAL)
2
Hi @JDK
So the idea is to start ur regex code from the end of ur string.
here’s the code : ([^\\]*$)
Cheers @JDK
1 Like
Yoichi
(Yoichi)
3
Hi,
Can you try the following expression?
System.IO.Path.GetFileName(strData)
or
System.Text.RegularExpressions.Regex.Match(strData,"[^\\]+?xlsx$").Value
Regards,
1 Like
samir
(Samir Mohite)
4
Hi @JDK,
there’s one simple method to get filename from path,
Path.GetFilename(“full path”)
2 Likes
JDK
(Josef R.)
5
Thanks buddy
Worked like a charm 
JDK
(Josef R.)
6
Thank you - this worked very well aswell 
system
(system)
Closed
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.