Regular expression for matching the directory part of a file path.
Install with npm
npm i dirname-regex --save
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.
Install dev dependencies:
node i -d && mocha
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb on January 12, 2015.