Parse filename from full path using regular expressions in C#
        Posted  
        
            by WindyCityEagle
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by WindyCityEagle
        
        
        
        Published on 2008-10-21T19:30:19Z
        Indexed on 
            2010/03/08
            14:06 UTC
        
        
        Read the original article
        Hit count: 402
        
How do I pull out the filename from a full path using regular expressions in C#?
Say I have the full path C:\CoolDirectory\CoolSubdirectory\CoolFile.txt.
How do I get out CoolFile.txt using the .NET flavor of regular expressions? I'm not really good with regular expressions, and my RegEx buddy and me couldn't figure this one out.
Also, in the course of trying to solve this problem, I realized that I can just use  System.IO.Path.GetFileName, but the fact that I couldn't figure out the regular expression is just making me unhappy and it's going to bother me until I know what the answer is.
© Stack Overflow or respective owner