Initial commit
[yaffs-website] / node_modules / unc-path-regex / README.md
1 # unc-path-regex [![NPM version](https://badge.fury.io/js/unc-path-regex.svg)](http://badge.fury.io/js/unc-path-regex)  [![Build Status](https://travis-ci.org/jonschlinkert/unc-path-regex.svg)](https://travis-ci.org/jonschlinkert/unc-path-regex)
2
3 > 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.
4
5 Visit the MSDN reference for [Common Data Types 2.2.57 UNC](https://msdn.microsoft.com/en-us/library/gg465305.aspx) for more information about UNC paths.
6
7 ## Install
8
9 Install with [npm](https://www.npmjs.com/)
10
11 ```sh
12 $ npm i unc-path-regex --save
13 ```
14
15 ## Usage
16
17 ```js
18 // unc-path-regex returns a function
19 var regex = require('unc-path-regex')();
20 ```
21
22 **true**
23
24 Returns true for windows UNC paths:
25
26 ```js
27 regex.test('\\/foo/bar');
28 regex.test('\\\\foo/bar');
29 regex.test('\\\\foo\\admin$');
30 regex.test('\\\\foo\\admin$\\system32');
31 regex.test('\\\\foo\\temp');
32 regex.test('\\\\/foo/bar');
33 regex.test('\\\\\\/foo/bar');
34 ```
35
36 **false**
37
38 Returns false for non-UNC paths:
39
40 ```js
41 regex.test('/foo/bar');
42 regex.test('/');
43 regex.test('/foo');
44 regex.test('/foo/');
45 regex.test('c:');
46 regex.test('c:.');
47 regex.test('c:./');
48 regex.test('c:./file');
49 regex.test('c:/');
50 regex.test('c:/file');
51 ```
52
53 ## Related projects
54
55 * [dotfile-regex](https://github.com/regexps/dotfile-regex): Regular expresson for matching dotfiles.
56 * [dotdir-regex](https://github.com/regexps/dotdir-regex): Regex for matching dot-directories, like `.git/`
57 * [dirname-regex](https://github.com/regexps/dirname-regex): Regular expression for matching the directory part of a file path.
58 * [is-unc-path](https://github.com/jonschlinkert/is-unc-path): Returns true if a filepath is a windows UNC file path.
59 * [is-glob](https://github.com/jonschlinkert/is-glob): Returns `true` if the given string looks like a glob pattern.
60 * [path-regex](https://github.com/regexps/path-regex): Regular expression for matching the parts of a file path.
61
62 ## Running tests
63
64 Install dev dependencies:
65
66 ```sh
67 $ npm i -d && npm test
68 ```
69
70 ## Contributing
71
72 Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/unc-path-regex/issues/new)
73
74 ## Author
75
76 **Jon Schlinkert**
77
78 + [github/jonschlinkert](https://github.com/jonschlinkert)
79 + [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
80
81 ## License
82
83 Copyright © 2015 Jon Schlinkert
84 Released under the MIT license.
85
86 ***
87
88 _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 07, 2015._