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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pete's Wicked ArcCatalog FeatureClass Path Validator
Expression
(?=^.{1,160}$)^(?:(?<Workspace>(?<Root>(?:(?<Drive>[a-zA-Z]\:)|(?<Server>\\{2}[a-zA-Z]\w*)))(?<DirectoryTree>(?:\\(?<Directory>(?:(?![\w\.]*\.(?:gdb|mdb|sde|mdf))[^\\/:*?<>"| .]+[^\\/:*?<>"|]*[^\\/:*?<>"| .]+)))*)(?:\\(?<Geodatabase>(?<GDBName>[a-zA-Z]\w*)(?<Extension>\.(?:gdb|mdb|sde|mdf))))?)\\?(?<FeatureDataset>[a-zA-Z]\w*)?(?:\\(?<BaseName>[a-zA-Z]\w*(?:\.shp)?)(?<!.+\k<Extension>.+\.shp|(?<!.+\k<Extension>.+)(?<!.+\.shp))))$
Description
Matches most valid ArcCatalog FeatureClass catalog paths. Rejects most invalid paths. Accepts mapped drive letters and UNC network paths. UNC Server names must begin with a letter and may only include letters and numbers. Will not accept directories that include ".gdb", ".mdb", ".sde", or ".mdf" in their name. Otherwise accepts mid-string spaces and "."s (dots) in directory names. Will not accept special characters in FeatureDataset or BaseName. Will not accept FeatureDatasets or BaseNames that begin with a number. Limits total path length to 160 characters. Accepts file, personal, sde, and SQL GDBs, as well as shapefiles. Shapefiles have the ".shp" extension and cannot appear in geodatabases. Accepts GDB Feature Datasets. Identifies <Workspace>, <Root>, <Drive>, <Server>, <DirectoryTree>, <Directory>, <Geodatabase>, <GDBName>, <Extension>, <FeatureDataset>, and <BaseName> as sub-strings.
Matches
A:\Dir1\Dir 2\Dir.3\Geodatabase.gdb\FeatureDataset\BaseName | b:\Dir1\Dir 2\Dir.3\Geodatabase.mdb\BaseName | C:\Dir_1\Dir 2\Dir.3\BaseName.shp | \\Server\Dir1\Dir 2\Dir.3\Geodatabase.sde\FeatureDataset\BaseName | d:\Geodatabase.gdb\Feature_Dataset\BaseName | \\Server\Base_Name.shp
Non-Matches
E:\Dir1\Dir 2\Dir.3\GeodatabaseWithNoBase.gdb | f:\Dir1\Dir 2\Dir.3\Geodatabase.mdb\FeatureDataset\BaseName\XtraName | G:\Dir1\ DirBeginsWithSpace\Dir3\BaseName | \\Server\Dir1\Dir 2\DirEndsIn.mdb\Geodatabase.mdb\FeatureDataset\BaseName | h:\Geodatabase.gdb\FeatureDataset\1BaseNameBeginsWithNum | \\Server HasSpace\Base_Name | k:\dir1\ShapefileWithoutExtension | m:\dir1\geodatabase.mdb\ShapefileInGDB.shp
Author Rating: Not yet rated. Peter Butteri
Source FeatureClassPath_v3
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-2025, RegexAdvice.com | ASP.NET Tutorials