mirror of
https://github.com/thangisme/notes.git
synced 2024-12-22 20:16:54 -05:00
.. | ||
index.js | ||
package.json | ||
readme.md |
clone-regexp
Clone and modify a RegExp instance
Install
$ npm install --save clone-regexp
Usage
var cloneRegexp = require('clone-regexp');
var re = /[a-z]/gi;
cloneRegexp(re);
//=> /[a-z]/gi
cloneRegexp(re) === re;
//=> false
cloneRegexp(re, {global: false});
//=> /[a-z]/i
cloneRegexp(re, {multiline: true});
//=> /[a-z]/gim
cloneRegexp(re, {source: 'unicorn'});
//=> /unicorn/gi
API
cloneRegexp(regexp, [options])
regex
Type: regexp
RegExp instance to clone.
options
Type: object
Properties: source
global
ignoreCase
multiline
sticky
unicode
Optionally modify the cloned RegExp instance.
License
MIT © Sindre Sorhus