Socket
Socket
Sign inDemoInstall

shebang-regex

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    shebang-regex

Regular expression for matching a shebang


Version published
Weekly downloads
61M
decreased by-1.95%
Maintainers
1
Install size
3.18 kB
Created
Weekly downloads
 

Package description

What is shebang-regex?

The shebang-regex npm package is a simple utility that provides a regular expression for matching shebang lines in files. A shebang line is the first line in a script file that is used to indicate the script interpreter to be used to execute the file. It is commonly found at the top of script files in Unix-based systems and starts with '#!'. This package helps in identifying and extracting the shebang line from files.

What are shebang-regex's main functionalities?

Shebang line matching

The shebang-regex package exports a regular expression that matches the shebang line. Here's an example of how to use it in code to test if a string contains a shebang line: `const shebangRegex = require('shebang-regex'); console.log(shebangRegex.test('#!/usr/bin/env node')); // true`

/^#!.+/

Other packages similar to shebang-regex

Readme

Source

shebang-regex Build Status

Regular expression for matching a shebang

Install

$ npm install --save shebang-regex

Usage

var shebangRegex = require('shebang-regex');
var str = '#!/usr/bin/env node\nconsole.log("unicorns");';

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

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

License

MIT © Sindre Sorhus

Keywords

FAQs

Last updated on 17 Feb 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc