utils-regex-from-string

WebJar for utils-regex-from-string

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

utils-regex-from-string
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

utils-regex-from-string
WebJar for utils-regex-from-string
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/kgryte/utils-regex-from-string

Download utils-regex-from-string

How to add to project

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

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : regex-regex jar [1.0.0,2)
org.webjars.npm : validate.io-string-primitive jar [1.0.0,2)

Project Modules

There are no modules declared in this project.

RegExp

NPM version Build Status Coverage Status Dependencies

Parses a regular expression string and returns a new regular expression.

Installation

$ npm install utils-regex-from-string

Usage

var regex = require( 'utils-regex-from-string' );

regex( str )

Parses a regular expression string and returns a new regular expression.

var re = regex( '/beep/' )
// returns /beep/

Note: provided strings must be properly escaped.

// Unescaped:
re = regex( '/\w+/' );
// returns /w+/

// Escaped:
re = regex( '/\\w+/' );
// returns /\w+/

Examples

var regex = require( 'utils-regex-from-string' );

console.log( regex( '/beep/' ) );
// returns /beep/

console.log( regex( '/[A-Z]*/' ) );
// returns /[A-Z]*/

console.log( regex( '/\\\\\\\//ig' ) );
// returns /\\\//ig

console.log( regex( '/[A-Z]{0,}/' ) );
// returns /[A-Z]{0,}/

console.log( regex( '/^boop$/' ) );
// returns /^boop$/

console.log( regex( '/(?:.*)/' ) );
// returns /(?:.*)/

console.log( regex( '/(?:beep|boop)/' ) );
// returns /(?:beep|boop)/

console.log( regex( '/\\w+/' ) );
// returns /\w+/

To run the example code from the top-level application directory,

$ node ./examples/index.js

Tests

Unit

Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:

$ make test

All new feature development should have corresponding unit tests to validate correct functionality.

Test Coverage

This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:

$ make test-cov

Istanbul creates a ./reports/coverage directory. To access an HTML version of the report,

$ make view-cov

License

MIT license.

Copyright

Copyright © 2015. Athan Reines.

Versions

Version
1.0.0