1.0.0 • Published 7 years ago
regnum v1.0.0
Regnum
Instead of getting array get an object with keys you specify. See Usage
section.
Install
npm install --save regnum
Usage
import Regnum from "regnum"
regnumObject = {
username: '[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+',
domain: '[a-zA-Z0-9-]+',
zone: '(?:\.[a-zA-Z0-9-]+)*'
};
regnum = new Regnum('^($username$)@($domain$)($zone$)$', regnumObject);
matchedObject = regnum.match('bender@ilovebender.com');
Result of matchedObject
is
{
username: 'bender',
domain: 'ilovebender',
zone: '.com'
}
Test
Simply run
npm test
Examples
More examples of usage are provided in ./test
folder.
Contribution
Contribution is welcome.
Dependencies
lodash
is the only dependency to this package.
License
MIT © Flycode LLC
1.0.0
7 years ago