All Projects → regexhq → Ext Regex

regexhq / Ext Regex

Licence: mit
Regular expression for matching file extensions.

Programming Languages

javascript
184084 projects - #8 most used programming language

ext-regex NPM version

Regular expression for matching file extensions. Matches single and/or multiple file extensions, like .min.js.

Install with npm

npm i ext-regex --save

Usage

var extRegex = require('ext-regex');

'a/b/c.min.js'.match(extRegex());
//=> ['.min.js', '.js', 'js'];

'a/b/c/.gitignore'.match(extRegex());
//=> ['.gitignore', '.gitignore', 'gitignore']

'a/b/c'.match(extRegex());
//=> null

'a/b/c.js'.test(extRegex());
//=> true

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].