Socket
Book a DemoInstallSign in
Socket

simple_regex_search

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple_regex_search

A very light-weight and simple NodeJS module to build regex search query .

1.0.7
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

A very light-weight and simple NodeJS module to build regex search query .

Usage

Download the module or install using npm npm install --save simple_regex_search

The module exposes a function that takes two parameters , search phrase and combined. the search phrase must be a single string or an array of the search phrases , the combined is a boolean that specify if the regex search must meet all the words or any.

If the combined flag is true , all returned regex would require all search phrases to exist for the regex search to return true.

The default value of the combined flag is false.

Example

let search = require('simple_regex_search');

Single phrase | String

would return the regex syntax /^(?=.\btest\b).$/

let example = search('test', true);

would return true

example('test');

would return false

example('something else');

Many Phrases | Array

would return the regex syntax /^(?=.\bvalueA\b)(?=.\bvalueB\b).*$/

let example2 = search(['valueA', 'valueB'], true);

would return false

example2('test');

would return true

example2('The order of ValueB and ValueA is not important');

Keywords

regex

FAQs

Package last updated on 30 Aug 2017

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.