You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
649 B

3 years ago
  1. # shebang-regex [![Build Status](https://travis-ci.org/sindresorhus/shebang-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/shebang-regex)
  2. > Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line
  3. ## Install
  4. ```
  5. $ npm install shebang-regex
  6. ```
  7. ## Usage
  8. ```js
  9. const shebangRegex = require('shebang-regex');
  10. const string = '#!/usr/bin/env node\nconsole.log("unicorns");';
  11. shebangRegex.test(string);
  12. //=> true
  13. shebangRegex.exec(string)[0];
  14. //=> '#!/usr/bin/env node'
  15. shebangRegex.exec(string)[1];
  16. //=> '/usr/bin/env node'
  17. ```
  18. ## License
  19. MIT © [Sindre Sorhus](https://sindresorhus.com)