JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1934482
  • Score
    100M100P100Q199345F
  • License MIT

Clone and modify a RegExp instance

Package Exports

  • clone-regexp

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (clone-regexp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

clone-regexp Build Status

Clone and modify a RegExp instance

Install

$ npm install --save clone-regexp
$ bower install --save clone-regexp
$ component install sindresorhus/clone-regexp

Usage

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