clone-regexp
Clone and modify a RegExp instance
Last updated a month ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install clone-regexp 
SYNC missed versions from official npm registry.

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 hasIndices global ignoreCase multiline dotAll sticky unicode unicodeSets lastIndex

Optionally modify the cloned RegExp instance.

Current Tags

  • 4.0.0                                ...           latest (a month ago)

11 Versions

  • 4.0.0                                ...           a month ago
  • 3.0.0                                ...           6 years ago
  • 2.2.0                                ...           8 years ago
  • 2.1.0                                ...           9 years ago
  • 2.0.0                                ...           9 years ago
  • 1.0.1                                ...           9 years ago
  • 1.0.0                                ...           12 years ago
  • 0.1.4                                ...           12 years ago
  • 0.1.3                                ...           12 years ago
  • 0.1.2                                ...           13 years ago
  • 0.1.1                                ...           13 years ago
Maintainers (1)
Downloads
Total 47
Today 0
This Week 0
This Month 14
Last Day 0
Last Week 11
Last Month 14
Dependencies (0)
None
Dev Dependencies (3)
Dependents (3)

© 2010 - cnpmjs.org x YWFE | Home | YWFE