Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
580 bytes
|
Rev | Line | |
---|
[6a3a178] | 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))
|
---|
| 4 |
|
---|
| 5 |
|
---|
| 6 | ## Install
|
---|
| 7 |
|
---|
| 8 | ```
|
---|
| 9 | $ npm install --save shebang-regex
|
---|
| 10 | ```
|
---|
| 11 |
|
---|
| 12 |
|
---|
| 13 | ## Usage
|
---|
| 14 |
|
---|
| 15 | ```js
|
---|
| 16 | var shebangRegex = require('shebang-regex');
|
---|
| 17 | var str = '#!/usr/bin/env node\nconsole.log("unicorns");';
|
---|
| 18 |
|
---|
| 19 | shebangRegex.test(str);
|
---|
| 20 | //=> true
|
---|
| 21 |
|
---|
| 22 | shebangRegex.exec(str)[0];
|
---|
| 23 | //=> '#!/usr/bin/env node'
|
---|
| 24 | ```
|
---|
| 25 |
|
---|
| 26 |
|
---|
| 27 | ## License
|
---|
| 28 |
|
---|
| 29 | MIT © [Sindre Sorhus](http://sindresorhus.com)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.