shebang-regex
Regular expression for matching a shebang line
Last updated 5 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install shebang-regex 
SYNC missed versions from official npm registry.

shebang-regex

Regular expression for matching a shebang line

Install

$ npm install shebang-regex

Usage

import shebangRegex from 'shebang-regex';

const string = '#!/usr/bin/env node\nconsole.log("unicorns");';

shebangRegex.test(string);
//=> true

shebangRegex.exec(string)[0];
//=> '#!/usr/bin/env node'

shebangRegex.exec(string)[1];
//=> '/usr/bin/env node'

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Current Tags

  • 4.0.0                                ...           latest (5 years ago)

4 Versions

  • 4.0.0                                ...           5 years ago
  • 3.0.0                                ...           8 years ago
  • 2.0.0                                ...           11 years ago
  • 1.0.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 20
Today 0
This Week 0
This Month 13
Last Day 0
Last Week 5
Last Month 6
Dependencies (0)
None
Dev Dependencies (3)

© 2010 - cnpmjs.org x YWFE | Home | YWFE