JSPM

filename-regex

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2613231
  • Score
    100M100P100Q199254F
  • License

Regular expression for matching file names, with or without extension.

Package Exports

  • filename-regex

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (filename-regex) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

filename-regex NPM version

Regular expression for matching file names, with or without extension.

Install with npm

npm i filename-regex --save

Usage

The regex is returned as a function.

var regex = require('filename-regex');

var match = 'abc/xyz.md'.match(regex());
//=> match[0] = 'xyz.md'
//=> match[1] = 'xyz'
//=> match[2] = '.md'

var match = 'abc/xyz'.match(regex());
//=> match[0] = 'xyz'
//=> match[1] = 'xyz'
//=> match[2] = ''

var match = 'abc/.gitignore'.match(regex());
//=> match[0] = '.gitignore'
//=> match[1] = ''
//=> match[2] = '.gitignore'

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 Jon Schlinkert
Released under the MIT license


This file was generated by verb on December 28, 2014.