Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 4, 2024 via pnpm

shebang-regex 3.0.0

Regular expression for matching a shebang line
Package summary
Share
0
issues
1
license
1
MIT
Package created
17 Feb 2015
Version published
27 Apr 2019
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
shebang-regex@3.0.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of shebang-regex 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does shebang-regex do?

The shebang-regex NPM package provides a regular expression specifically for matching a Shebang line in text. Shebang lines are meta-syntax lines found at the top of scripts in Unix-based systems, and play a vital role in specifying the interpreter for script execution. It's a popular tool among developers dealing with Unix-like environments.

How do you use shebang-regex?

Using shebang-regex is simple and straightforward. After installing it using npm by running npm install shebang-regex, you can readily import it into your JavaScript file with the line import shebangRegex from 'shebang-regex';.

Here's an example with a string starting with a Shebang line, which this package helps you identify:

import shebangRegex from 'shebang-regex';

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

// Test if the string contains a shebang
console.log(shebangRegex.test(string)); // true

// Extract the shebang line
console.log(shebangRegex.exec(string)[0]); // '#!/usr/bin/env node'

// Extract the path of the shebang
console.log(shebangRegex.exec(string)[1]); // '/usr/bin/env node'

In this example, we use .test() to check whether the string contains a shebang, and .exec() to extract either the entire shebang line or its path specifically.

Where are the shebang-regex docs?

The documentation for the shebang-regex package can be found directly in its README file on GitHub. The readme, located at https://github.com/sindresorhus/shebang-regex, contains all necessary information on how to install and use the package. There are no separate docs for shebang-regex. As it's designed to serve a specific and simple function, the README on GitHub provides the most complete and relevant documentation for the tool.