You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

shebang-regex

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shebang-regex

Regular expression for matching a shebang line


Version published
Weekly downloads
63M
increased by0.95%
Maintainers
1
Install size
4.20 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

Regular expression for matching a shebang line

Install

$ npm install shebang-regex

Usage

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'

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Keywords

FAQs

Package last updated on 13 Aug 2021

Did you know?

Socket

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
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc