JSPM

reginald

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q14951F
  • License MIT

Clone and modify a RegExp instance, including removing, prepending, appending & replacing the source

Package Exports

  • reginald

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 (reginald) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

reginald Build Status

Clone and modify a RegExp instance, including removing, prepending, appending & replacing the source

Reginald is based on clone-regexp by sindresorhus. Reginald adds source manipulation functionality on top of what clone-regexp offered

Install

$ npm i -S reginald

Usage

var reggie = require('reginald');
var re = /[a-z]/gi;

reggie(re);
//=> /[a-z]/gi

reggie(re) === re;
//=> false

reggie(re, {global: false});
//=> /[a-z]/i

reggie(re, {multiline: true});
//=> /[a-z]/gim

reggie(re, {source: 'wombat'});
//=> /wombat/gi

reggie(/a/, {replace: ['a','b']})
//=> /b/

reggie(/ab/, {remove: 'a'})
//=> /b/

reggie(/a/, {prepend: 'b'})
//=> /ba/

reggie(/a/, {append: 'b'})
//=> /ab/

reggie(/ab/, {remove: 'b'})
//=> /a/

API

reggie(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 MIT © James Womack