{"id":16719102,"url":"https://github.com/kgryte/regex-extname","last_synced_at":"2025-10-31T14:30:36.917Z","repository":{"id":57352253,"uuid":"42435292","full_name":"kgryte/regex-extname","owner":"kgryte","description":"Regular expression to capture a filename extension.","archived":false,"fork":false,"pushed_at":"2015-09-14T20:04:05.000Z","size":128,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-02T06:17:00.060Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kgryte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-14T08:00:20.000Z","updated_at":"2019-08-18T16:51:39.000Z","dependencies_parsed_at":"2022-09-15T23:52:14.358Z","dependency_job_id":null,"html_url":"https://github.com/kgryte/regex-extname","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgryte%2Fregex-extname","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgryte%2Fregex-extname/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgryte%2Fregex-extname/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgryte%2Fregex-extname/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kgryte","download_url":"https://codeload.github.com/kgryte/regex-extname/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238945642,"owners_count":19556701,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T21:40:11.448Z","updated_at":"2025-10-31T14:30:36.871Z","avatar_url":"https://github.com/kgryte.png","language":"JavaScript","readme":"Filename Extension\n===\n[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][codecov-image]][codecov-url] [![Dependencies][dependencies-image]][dependencies-url]\n\n\u003e [Regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) to capture a filename extension.\n\n\n## Installation\n\n``` bash\n$ npm install regex-extname\n```\n\n\n## Usage\n\n``` javascript\nvar re = require( 'regex-extname' );\n```\n\n#### re\n\n[Regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) to capture a filename extension. \n\n``` javascript\nvar ext;\n\n// On a POSIX platform...\next = re.exec( '/foo/bar/index.js' )[ 1 ];\n// returns '.js'\n\n// On a Windows platform...\next = re.exec( 'C:\\\\foo\\\\bar\\\\index.js' )[ 1 ];\n// returns '.js'\n```\n\n\n#### re.posix\n\n[Regular expression](https://github.com/kgryte/regex-extname-posix) to capture a [POSIX](https://en.wikipedia.org/wiki/POSIX) filename extension.\n\n\n#### re.win32\n\n[Regular expression](https://github.com/kgryte/regex-extname-windows) to capture a Windows filename extension.\n\n\n\n## Notes\n\n*\t The main exported [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) is [platform](https://github.com/kgryte/node-check-if-windows)-dependent. If the current process is running on Windows, `re === re.win32`; otherwise, `re === re.posix`.\n\n\n## Examples\n\n``` javascript\nvar re = require( 'regex-extname' );\n\nvar ext;\n\n// Assuming a POSIX platform...\next = re.exec( '/foo/bar/index.js' )[ 1 ];\nconsole.log( ext );\n// returns '.js'\n\next = re.posix.exec( '/foo/bar/home.html' )[ 1 ];\nconsole.log( ext );\n// returns '.html'\n\next = re.win32.exec( 'C:\\\\foo\\\\bar\\\\home.html' )[ 1 ];\nconsole.log( ext );\n// returns '.html'\n```\n\nTo run the example code from the top-level application directory,\n\n``` bash\n$ node ./examples/index.js\n```\n\n\n## Tests\n\n### Unit\n\nUnit tests use the [Mocha](http://mochajs.org/) test framework with [Chai](http://chaijs.com) assertions. To run the tests, execute the following command in the top-level application directory:\n\n``` bash\n$ make test\n```\n\nAll new feature development should have corresponding unit tests to validate correct functionality.\n\n\n### Test Coverage\n\nThis repository uses [Istanbul](https://github.com/gotwarlost/istanbul) as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:\n\n``` bash\n$ make test-cov\n```\n\nIstanbul creates a `./reports/coverage` directory. To access an HTML version of the report,\n\n``` bash\n$ make view-cov\n```\n\n\n---\n## License\n\n[MIT license](http://opensource.org/licenses/MIT).\n\n\n## Copyright\n\nCopyright \u0026copy; 2015. Athan Reines.\n\n\n[npm-image]: http://img.shields.io/npm/v/regex-extname.svg\n[npm-url]: https://npmjs.org/package/regex-extname\n\n[travis-image]: http://img.shields.io/travis/kgryte/regex-extname/master.svg\n[travis-url]: https://travis-ci.org/kgryte/regex-extname\n\n[codecov-image]: https://img.shields.io/codecov/c/github/kgryte/regex-extname/master.svg\n[codecov-url]: https://codecov.io/github/kgryte/regex-extname?branch=master\n\n[dependencies-image]: http://img.shields.io/david/kgryte/regex-extname.svg\n[dependencies-url]: https://david-dm.org/kgryte/regex-extname\n\n[dev-dependencies-image]: http://img.shields.io/david/dev/kgryte/regex-extname.svg\n[dev-dependencies-url]: https://david-dm.org/dev/kgryte/regex-extname\n\n[github-issues-image]: http://img.shields.io/github/issues/kgryte/regex-extname.svg\n[github-issues-url]: https://github.com/kgryte/regex-extname/issues\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgryte%2Fregex-extname","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkgryte%2Fregex-extname","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgryte%2Fregex-extname/lists"}