regex-regex
v1.0.0
Published
Regular expression to parse a regular expression string.
Maintainers
Readme
RegExp String
Regular expression to parse a regular expression string.
Installation
$ npm install regex-regexUsage
var re = require( 'regex-regex' );re
Regular expression to parse a regular expression string.
var bool = re.test( '/^beep$/' );
// returns true
bool = re.test( '' );
// returns falseRegular expression strings should be escaped.
bool = re.test( '/^\/([^\/]+)\/(.*)$/' );
// returns false
bool = re.test( '/^\\/([^\\/]+)\\/(.*)$/' );
// returns trueExamples
var re = require( 'regex-regex' );
console.log( re.test( '/beep/' ) );
// returns true
console.log( re.test( '/^.*$/ig' ) );
// returns true
console.log( re.test( '/^\\/([^\\/]+)\\/(.*)$/' ) );
// returns true
console.log( re.test( '/^\/([^\/]+)\/(.*)$/' ) );
// returns false
console.log( re.test( '/boop' ) );
// returns false
console.log( re.test( '' ) );
// returns falseTo run the example code from the top-level application directory,
$ node ./examples/index.jsTests
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 testAll 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-covIstanbul creates a ./reports/coverage directory. To access an HTML version of the report,
$ make view-covLicense
Copyright
Copyright © 2015. Athan Reines.
