regexp-clone

WebJar for regexp-clone

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

regexp-clone
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

regexp-clone
WebJar for regexp-clone
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/aheckmann/regexp-clone

Download regexp-clone

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/regexp-clone/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>regexp-clone</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/regexp-clone/
implementation 'org.webjars.npm:regexp-clone:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/regexp-clone/
implementation ("org.webjars.npm:regexp-clone:1.0.0")
'org.webjars.npm:regexp-clone:jar:1.0.0'
<dependency org="org.webjars.npm" name="regexp-clone" rev="1.0.0">
  <artifact name="regexp-clone" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='regexp-clone', version='1.0.0')
)
libraryDependencies += "org.webjars.npm" % "regexp-clone" % "1.0.0"
[org.webjars.npm/regexp-clone "1.0.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

regexp-clone

Clones RegExps with flag and lastIndex preservation.

const regexpClone = require('regexp-clone');

const a = /somethin/misguy;
console.log(a.global); // true
console.log(a.ignoreCase); // true
console.log(a.multiline); // true
console.log(a.dotAll); // true
console.log(a.unicode); // true
console.log(a.sticky); // true

const b = regexpClone(a);
console.log(b.global); // true
console.log(b.ignoreCase); // true
console.log(b.multiline); // true
console.log(b.dotAll); // true
console.log(b.unicode); // true
console.log(b.sticky); // true

const c = /hi/g;
c.test('this string hi there');
assert.strictEqual(c.lastIndex, 3);

const d = regexpClone(c);
assert.strictEqual(d.lastIndex, 3);
d.test('this string hi there');
assert.strictEqual(d.lastIndex, 14);
assert.strictEqual(c.lastIndex, 3);
npm install regexp-clone

License

MIT

Versions

Version
1.0.0