# shebang-regex

> Regular expression for matching a shebang line

Latest version **4.0.0** (published 2021-08-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install shebang-regex
pnpm add shebang-regex
yarn add shebang-regex
bun add shebang-regex
```

## Health

**Score 28/100 (F)** — status: abandoned.

Positive: has types package; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2021-08-13 |
| First published | 2015-02-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/shebang-regex) |
| Module format | ESM |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 0 |
| Unpacked size | 3.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 48 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | regex, regexp, shebang, match, test, line |

## Links

- npm: https://www.npmjs.com/package/shebang-regex
- Repository: https://github.com/sindresorhus/shebang-regex
- Homepage: https://github.com/sindresorhus/shebang-regex#readme
- Issues: https://github.com/sindresorhus/shebang-regex/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/shebang-regex

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2021-08-13
- 3.0.0 — 2019-04-27
- 2.0.0 — 2015-12-04
- 1.0.0 — 2015-02-17

## README

# shebang-regex

> Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line

## Install

```
$ npm install shebang-regex
```

## Usage

```js
import shebangRegex from 'shebang-regex';

const string = '#!/usr/bin/env node\nconsole.log("unicorns");';

shebangRegex.test(string);
//=> true

shebangRegex.exec(string)[0];
//=> '#!/usr/bin/env node'

shebangRegex.exec(string)[1];
//=> '/usr/bin/env node'
```

---

<div align="center">
	<b>
		<a href="https://tidelift.com/subscription/pkg/npm-shebang-regex?utm_source=npm-shebang-regex&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
	</b>
	<br>
	<sub>
		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
	</sub>
</div>

---
_Source: https://npm.io/package/shebang-regex · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
