dirname-regex
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/dirname-regex package

1.0.0 • Public • Published

dirname-regex NPM version

Regular expression for matching the directory part of a file path.

Install with npm

npm i dirname-regex --save

Usage

var dirnameRe = require('dirname-regex');
var match = 'a/b/c/d.md'.match(dirnameRe());
 
match[0];
//=> 'a/b/c/d.md'
 
match[1];
//=> 'a/b/c/'
 
match[2];
//=> 'a/b/c'

See the tests for more use cases and expected results.

Run tests

Install dev dependencies:

node i -d && mocha

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb on January 12, 2015.

Package Sidebar

Install

npm i dirname-regex

Weekly Downloads

13

Version

1.0.0

License

MIT

Last publish

Collaborators

  • doowb
  • jonschlinkert