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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Parse Windows Filename / Pathname (complex version)
Expression
/(?:(.):)?(?:(.*)\\)?((?:[^.]|.(?=[^.]*\.))*)(?:\.(.*))?/
Description
Does not validate. For parsing a file name known to be valid. Handles periods in the file name. Does not include terminating characters in the output, as preferred. Javascript exec() method produces the following array elements: [1]=drive; [2]=path; [3]=filename; [4]=extension; Matching Example 1 output: [1]=d [2]=\p.p\p [3]=f.f [4]=e Matching Example 2 output: [1]=[undefined] [2]=[empty string] [3]=f [4]=[undefined]
Matches
'd:\\p.p\\p\\f.f.e' | '\\f'
Non-Matches
matches all
Author Rating: Not yet rated. Brian \S\s
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-2018, RegexAdvice.com | ASP.NET Tutorials