Pibd-21_Ievlewa_M.D._Intern.../node_modules/shebang-regex/readme.md

34 lines
649 B
Markdown
Raw Normal View History

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