Skip to content

regexhq/filename-regex

Repository files navigation

filename-regex NPM version

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

Install with npm

npm i filename-regex --save

Usage

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

'a/b/c/d.min.js'.match(regex());
//=> match[0] = 'd.min.js'
//=> match[1] = 'd'
//=> match[2] = '.min.js'
//=> match[3] = '.js'
//=> match[4] = 'js'

Match groups:

  • [0] => filename
  • [1] => basename
  • [2] => multiple extensions
  • [3] => extension with dot
  • [4] => extension without dot

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


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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •