Complexity Score
Low
Open Issues
1
Dependent Projects
206
Weekly Downloadsglobal
7,132,001
Downloads
Readme
unc-path-regex
Regular expression for testing if a file path is a windows UNC file path. Can also be used as a component of another regexp via the .source
property.
Visit the MSDN reference for Common Data Types 2.2.57 UNC for more information about UNC paths.
Install
Install with npm
$ npm i unc-path-regex --save
Usage
// unc-path-regex returns a function
var regex = require('unc-path-regex')();
true
Returns true for windows UNC paths:
regex.test('\\/foo/bar');
regex.test('\\\\foo/bar');
regex.test('\\\\foo\\admin$');
regex.test('\\\\foo\\admin$\\system32');
regex.test('\\\\foo\\temp');
regex.test('\\\\/foo/bar');
regex.test('\\\\\\/foo/bar');
false
Returns false for non-UNC paths:
regex.test('/foo/bar');
regex.test('/');
regex.test('/foo');
regex.test('/foo/');
regex.test('c:');
regex.test('c:.');
regex.test('c:./');
regex.test('c:./file');
regex.test('c:/');
regex.test('c:/file');
Related projects
- dotfile-regex: Regular expresson for matching dotfiles.
- dotdir-regex: Regex for matching dot-directories, like
.git/
- dirname-regex: Regular expression for matching the directory part of a file path.
- is-unc-path: Returns true if a filepath is a windows UNC file path.
- is-glob: Returns
true
if the given string looks like a glob pattern. - path-regex: Regular expression for matching the parts of a file path.
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jon Schlinkert
- github/jonschlinkert
- twitter/jonschlinkert
License
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on July 07, 2015.
Dependencies
Loading dependencies...
CVE IssuesActive
0
Scorecards Score
3.30
Test Coverage
No Data
Follows Semver
Yes
Github Stars
8
Dependenciestotal
1
DependenciesOutdated
0
DependenciesDeprecated
0
Threat Modelling
No
Repo Audits
No
Learn how to distribute unc-path-regex in your own private NPM registry
$npm config set registry
https://npm.cloudsmith.com/owner/repo
/Processing...
✓Done
$npm install unc-path-regex
/Processing...
✓Done
3 Releases
NPM on Cloudsmith