shebang-regex
Regular expression for matching a shebang line
Last updated 5 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm 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                                ...           7 years ago
  • 2.0.0                                ...           10 years ago
  • 1.0.0                                ...           11 years ago
Maintainers (1)
Downloads
Today 1
This Week 174
This Month 257
Last Day 30
Last Week 123
Last Month 619
Dependencies (0)
None
Dev Dependencies (3)

Copyright 2013 - present © cnpmjs.org | Home |