🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

clone-regexp

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clone-regexp

Clone and modify a RegExp instance

latest
Source
npmnpm
Version
3.0.0
Version published
Weekly downloads
2.3M
-13.5%
Maintainers
1
Weekly downloads
 
Created
Source

clone-regexp

Clone and modify a RegExp instance

Install

$ npm install clone-regexp

Usage

import cloneRegexp from 'clone-regexp';

const regex = /[a-z]/gi;

cloneRegexp(regex);
//=> /[a-z]/gi

cloneRegexp(regex) === regex;
//=> false

cloneRegexp(regex, {global: false});
//=> /[a-z]/i

cloneRegexp(regex, {multiline: true});
//=> /[a-z]/gim

cloneRegexp(regex, {source: 'unicorn'});
//=> /unicorn/gi

API

cloneRegexp(regexp, options?)

regex

Type: RegExp

Regex to clone.

options

Type: object
Properties: source global ignoreCase multiline dotAll sticky unicode lastIndex

Optionally modify the cloned RegExp instance.

Keywords

regexp

FAQs

Package last updated on 08 Apr 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