Extracting file name

R

Robert Bravery

Hi all,

Using regex, how can I extract just the file name of a given path and
filename
as in
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\importXL\importXL\opex06det.xls
where all I want is opex06det.xls

Thanks
Robert
 
T

Thomas T. Veldhouse

Robert Bravery said:
Hi all,

Using regex, how can I extract just the file name of a given path and
filename
as in
C:\Documents and Settings\Administrator\My Documents\Visual Studio
2005\Projects\importXL\importXL\opex06det.xls
where all I want is opex06det.xls

Why not just use:

string fn = System.IO.Path.GetFileName(examplePathFromAbove);
 
K

Kevin Spencer

System.IO.Path.GetFileName(string)

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top