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 (simple 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; IF extension exists THEN [3]=filename; [4]=extension; ELSE [3]=undefined; [4]=filename. (To avoid the awkwardness, see "Parse Windows Filename (complex version)." 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]=[undefined] [4]=f Matching Example 3 output: [1]=undefined [2]=undefined [3]=f [4]=e
Matches
'd:\\p.p\\p\\f.f.e' | '\\f' | 'f.e'
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-2024, RegexAdvice.com | ASP.NET Tutorials