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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^((?<DRIVE>[a-z]:)|(\\\\(?<SERVER>[0-9]*[a-z\-][a-z0-9\-]*)\\(?<VOLUME>[^\.\x01-\x1F\\""\*\?<>:|\\/][^\x01-\x1F\\""\*\?|><:\\/]*)))?(?<FOLDERS>(?<FOLDER1>(\.|(\.\.)|([^\.\x01-\x1F\\""\*\?|><:\\/][^\x01-\x1F\\""\*\?<>:|\\/]*)))?(?<FOLDERm>[\\/](\.|(\.\.)|([^\.\x01-\x1F\\""\*\?|><:\\/][^\x01-\x1F\\""\*\?<>:|\\/]*)))*)?[\\/]?$
Description
Verify "well formed-ness" of DOS or UNC paths. Passed over 170 NUnit test, (took 3 complete rewrites) Components of a path: DRIVE:=[a-z]: SERVER:=[0-9]*[a-z\-][a-z0-9\-]* FNAME:=[^\.\x01-\x1F\\""\*\?<>:|\\/][^\x01-\x1F\\""\*\?<>:|\\/]* VOLUME:=FNAME UNC:=\\SERVER\VOLUME ROOT:=(DRIVE|UNC) FOLDER:=.|..|FNAME FOLDERS:=FOLDER?([\]FOLDER)*[\]? PATH:=^ROOT?FOLDERS?$
Matches
his is a very 'long' folder\that is.part of 2 folders. | b\c\..\x. | \\Dads\Mp3\FileName1\.\TestDir2
Non-Matches
\\1.dads\C | \. folder\ | .ext
Author Rating: Not yet rated. Tristen Fielding
Source Tristen Fielding
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

Title: HTML encodings
Name: Jesper
Date: 6/2/2009 5:00:44 AM
Comment:
The expression is malformed... It contains HTML character encodings. <http://en.wikipedia.org/wiki/Character_encodings_in_HTML>


Title: HTML encodings
Name: Jesper
Date: 6/2/2009 5:00:16 AM
Comment:
The expression is malformed... It contains HTML character encodings. <http://en.wikipedia.org/wiki/Character_encodings_in_HTML>


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