RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Folder filename extension
Expression
(.*[\\\/]|^)(.*?)(?:[\.]|$)([^\.\s]*$)
Description
This expression returns $1-folder (including trailing delimiter) $2-filename (without ext) $3-extension (excluding dot) Note: some captures may be blank, in the case the folder, filename or ext is missing Note2: tested on Perl regular expression engine
Matches
test -> [][test][] | test.txt -> [][test][txt] | C:\test -> [C:\][test][] | C:\test.txt -> [C:\][test][txt] | C:\test.txt\testing.txt -> [C:\test.txt\][testing][txt] | C:\folder\test -> [C:\folder\][test][] | C:\folder\test.txt.txt -> [C:\folder\][test.txt][txt] | C:\folder\test.txt.txt\testing.txt -> [C:\folder\test.txt.txt\][testing][txt] | /usr/test -> [/usr/][test][] | /usr/test.txt -> [/usr/][test][txt] | /usr/test.txt/testing.pdf -> [/usr/test.txt/][testing][pdf]
Non-Matches
N/A
Author Rating: Not yet rated. Petr Danihlik
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials