|
|
%!s(int64=3) %!d(string=hai) anos | |
|---|---|---|
| .. | ||
| index.d.ts | %!s(int64=3) %!d(string=hai) anos | |
| index.js | %!s(int64=3) %!d(string=hai) anos | |
| license | %!s(int64=3) %!d(string=hai) anos | |
| package.json | %!s(int64=3) %!d(string=hai) anos | |
| readme.md | %!s(int64=3) %!d(string=hai) anos | |
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