1
0
mirror of https://github.com/thangisme/notes.git synced 2024-10-31 23:37:18 -04:00
notes/node_modules/clone-regexp/readme.md
Patrick Marsceill b7b0d0d7bf
Initial commit
2017-03-09 13:16:08 -05:00

1.5 KiB

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