lhl 6ff0e96ad3 8-4-1 1 年間 前
..
node_modules 6ff0e96ad3 8-4-1 1 年間 前
index.d.ts 6ff0e96ad3 8-4-1 1 年間 前
index.js 6ff0e96ad3 8-4-1 1 年間 前
license 6ff0e96ad3 8-4-1 1 年間 前
package.json 6ff0e96ad3 8-4-1 1 年間 前
readme.md 6ff0e96ad3 8-4-1 1 年間 前

readme.md

clone-regexp Build Status

Clone and modify a RegExp instance

Install

$ npm install clone-regexp

Usage

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

API

cloneRegexp(regexp, [options])

regex

Type: RegExp

Regex to clone.

options

Type: Object
Properties: source global ignoreCase multiline dotAll sticky unicode lastIndex

Optionally modify the cloned RegExp instance.

License

MIT © Sindre Sorhus