peach a19a732be8 commit message | 2 lat temu | |
---|---|---|
.. | ||
index.d.ts | 2 lat temu | |
index.js | 2 lat temu | |
license | 2 lat temu | |
package.json | 2 lat temu | |
readme.md | 2 lat temu |
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