Skip to content

BlakeGuilloud/rhaegar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rhaegar

Build Status NPM version styled with prettier

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:

  • email
  • dateTime
  • notBinary
  • alphaNumeric
  • alpha
  • numeric

Supported Methods:

  • test (default)
  • match

About

Proof of concept RegEx library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published