$ npm install clone-regexp
Clone and modify a RegExp instance
$ npm install clone-regexp
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
Type: RegExp
Regex to clone.
Type: object
Properties: source
global
ignoreCase
multiline
dotAll
sticky
unicode
lastIndex
Optionally modify the cloned RegExp
instance.
© 2010 - cnpmjs.org x YWFE | Home | YWFE