Skip to content
Fernando Martínez edited this page Oct 6, 2013 · 4 revisions

Regularity

Regular expresions for human beings.

Install

Regularity is designed as a node module and should be easily installable my a mere:

npm install regularity

Usage

Inyour code:

> var R = require('regularity'); var r = new R();
undefined
> idNumber = r.startWith('').between([8,8],'digits').atMost(1,'letter').endWith('').done();
/^[0-9]{8,8}[A-Za-z]{0,1}$/
> idNumber.test('12345678Z');
true
Clone this wiki locally