Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

regex-not

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

regex-not

Create a javascript regular expression for matching everything except for the given string.

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.6M
decreased by-57.06%
Maintainers
1
Weekly downloads
 
Created

What is regex-not?

The regex-not npm package is designed to create regular expressions for matching everything except a specified pattern. This can be particularly useful when you need to exclude certain patterns from your matches.

What are regex-not's main functionalities?

Basic Negation

This feature allows you to create a regular expression that matches any string except the specified pattern. In this example, the pattern 'foo' is excluded from the matches.

const not = require('regex-not');
const re = not('foo');
console.log(re); // => /^(?:(?!^(?:foo)$).)+$/

Negation with Flags

This feature allows you to add flags to the negated regular expression. In this example, the global flag 'g' is added to the pattern that excludes 'foo'.

const not = require('regex-not');
const re = not('foo', { flags: 'g' });
console.log(re); // => /^(?:(?!^(?:foo)$).)+$/g

Negation with Custom Delimiters

This feature allows you to specify custom delimiters for the negated pattern. In this example, the delimiters '<' and '>' are used around the pattern 'foo'.

const not = require('regex-not');
const re = not('foo', { delimiters: ['<', '>'] });
console.log(re); // => /^(?:(?!<foo>).)+$/

Other packages similar to regex-not

Keywords

FAQs

Package last updated on 27 Sep 2016

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc