Pibd-21_Alekseev_I.S._Inter.../IP/node_modules/shebang-regex/readme.md

34 lines
649 B
Markdown
Raw Normal View History

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