peach a19a732be8 commit message | 2 年之前 | |
---|---|---|
.. | ||
index.d.ts | 2 年之前 | |
index.js | 2 年之前 | |
license | 2 年之前 | |
package.json | 2 年之前 | |
readme.md | 2 年之前 |
Clone and modify a RegExp instance
$ npm install clone-regexp
const cloneRegexp = require('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.
MIT © Sindre Sorhus