rhaegar
v1.0.9
Published
Proof of concept Regex library
Downloads
2
Readme
rhaegar
A lightweight, zero dependency javascript library for dealing with regular expressions.
Installation:
$ yarn add rhaegar
$ npm install rhaegar --save
Usage:
import Rhaegar from 'rhaegar';
const testEmail = new Rhaeger({ pattern: 'email', method: 'test' });
testEmail('[email protected]');
// => true
testEmail('greyworm@yahoo');
// => false
const matchEmail = new Rhaegar({ pattern: 'email', method: 'match' });
const matched = matchEmail('[email protected]');
// matched => [ '[email protected]', index: 0, input: '[email protected]' ]
// matched[0] => '[email protected]';
// matched.index => 0
// matched.input => '[email protected]';
const testDateTime = new Rhaegar({ pattern: 'dateTime' });
testDateTime('30-11-2003 8:45');
// => true
testDateTime('11-2003 8:45');
// => false
Supported Patterns:
- dateTime
- notBinary
- alphaNumeric
- alpha
- numeric
Supported Methods:
- test (default)
- match