1 | # shebang-regex
|
2 |
|
3 | > Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line
|
4 |
|
5 | ## Install
|
6 |
|
7 | ```
|
8 | $ npm install shebang-regex
|
9 | ```
|
10 |
|
11 | ## Usage
|
12 |
|
13 | ```js
|
14 | import shebangRegex from 'shebang-regex';
|
15 |
|
16 | const string = '#!/usr/bin/env node\nconsole.log("unicorns");';
|
17 |
|
18 | shebangRegex.test(string);
|
19 | //=> true
|
20 |
|
21 | shebangRegex.exec(string)[0];
|
22 | //=> '#!/usr/bin/env node'
|
23 |
|
24 | shebangRegex.exec(string)[1];
|
25 | //=> '/usr/bin/env node'
|
26 | ```
|
27 |
|
28 | ---
|
29 |
|
30 | <div align="center">
|
31 | <b>
|
32 | <a href="https://tidelift.com/subscription/pkg/npm-shebang-regex?utm_source=npm-shebang-regex&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
33 | </b>
|
34 | <br>
|
35 | <sub>
|
36 | Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
37 | </sub>
|
38 | </div>
|