github-pages-deploy-action/node_modules/shebang-regex/readme.md

34 lines
649 B
Markdown
Raw Permalink Normal View History

2020-01-28 13:08:03 +08:00
# shebang-regex [![Build Status](https://travis-ci.org/sindresorhus/shebang-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/shebang-regex)
2020-05-15 05:33:08 +08:00
> Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line
2020-01-28 13:08:03 +08:00
## Install
```
2020-05-15 05:33:08 +08:00
$ npm install shebang-regex
2020-01-28 13:08:03 +08:00
```
## Usage
```js
2020-05-15 05:33:08 +08:00
const shebangRegex = require('shebang-regex');
2020-01-28 13:08:03 +08:00
2020-05-15 05:33:08 +08:00
const string = '#!/usr/bin/env node\nconsole.log("unicorns");';
shebangRegex.test(string);
2020-01-28 13:08:03 +08:00
//=> true
2020-05-15 05:33:08 +08:00
shebangRegex.exec(string)[0];
2020-01-28 13:08:03 +08:00
//=> '#!/usr/bin/env node'
2020-05-15 05:33:08 +08:00
shebangRegex.exec(string)[1];
//=> '/usr/bin/env node'
2020-01-28 13:08:03 +08:00
```
## License
2020-05-15 05:33:08 +08:00
MIT © [Sindre Sorhus](https://sindresorhus.com)