1.0.7 • Published 3 years ago

types-regex v1.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

types-regex

NPM version Downloads

Regular expression for email. You shouldn't use RegExp for validating values. Use it only for hinting to the user.

Installation

$ npm install types-regex

Usage

Email

import {emailRegex} from 'types-regex';

emailRegex.test('dev+bob@gmail.com');
// => true

Phone

import {phoneRegex} from 'types-regex';

phoneRegex.test('01012345678');
// => true

Domain

import {domainRegex} from 'types-regex';

// if doesn't include params
domainRegex.dom.test('www.devbob.com');
// => true

// if include params
domainRegex.dom.test('www.devbob.com?email=devbob@gmail.com');
// => true

change phone forms

import {phoneFormChange} from 'types-regex';

phoneFormChange('01012345678');
// => 010-1234-5678

License

MIT