1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-16 17:58:54 -05:00
notes/node_modules/clone-regexp
Patrick Marsceill b7b0d0d7bf
Initial commit
2017-03-09 13:16:08 -05:00
..
index.js Initial commit 2017-03-09 13:16:08 -05:00
package.json Initial commit 2017-03-09 13:16:08 -05:00
readme.md Initial commit 2017-03-09 13:16:08 -05:00

clone-regexp Build Status

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