main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
649 bytes
|
Line | |
---|
1 | # shebang-regex [![Build Status](https://travis-ci.org/sindresorhus/shebang-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/shebang-regex)
|
---|
2 |
|
---|
3 | > Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line
|
---|
4 |
|
---|
5 |
|
---|
6 | ## Install
|
---|
7 |
|
---|
8 | ```
|
---|
9 | $ npm install shebang-regex
|
---|
10 | ```
|
---|
11 |
|
---|
12 |
|
---|
13 | ## Usage
|
---|
14 |
|
---|
15 | ```js
|
---|
16 | const shebangRegex = require('shebang-regex');
|
---|
17 |
|
---|
18 | const string = '#!/usr/bin/env node\nconsole.log("unicorns");';
|
---|
19 |
|
---|
20 | shebangRegex.test(string);
|
---|
21 | //=> true
|
---|
22 |
|
---|
23 | shebangRegex.exec(string)[0];
|
---|
24 | //=> '#!/usr/bin/env node'
|
---|
25 |
|
---|
26 | shebangRegex.exec(string)[1];
|
---|
27 | //=> '/usr/bin/env node'
|
---|
28 | ```
|
---|
29 |
|
---|
30 |
|
---|
31 | ## License
|
---|
32 |
|
---|
33 | MIT © [Sindre Sorhus](https://sindresorhus.com)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.