A JavaScript library
Regex was a mistake,
just like your ex.
Meet zeroReg — write regex without tears or confusion.
91.1kb gzippedZero dependenciesTypeScript ready
validate-email.js
1/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
✓"ah yes, perfectly clear" — no one ever
same thing, but make it make sense
validate-email.js
1import { email } from 'zeroReg/patterns'
2
3// that's it. that's the whole thing.
4email.test('yo@dev.io') // true
✓Your future self will thank you
zeroReg v1.0
Or build your own patterns
like a normal person
No PhD in hieroglyphics required. Just functions that say what they do.
phone-number.js
1import { digit, literal, optional } from 'zeroReg'
2
3const phone = optional('+')
4 .then(digit(3))
5 .then('-')
6 .then(digit(3))
7 .then('-')
8 .then(digit(4))
9
10phone.test('123-456-7890') // true
11phone.toRegex() // /\+?\d{3}-\d{3}-\d{4}/
✓You can actually read this in 6 months
0 headaches
Move on. Get zeroReg.
$npm install zeroReg